 |
BOOK: Professional iPhone and iPad Application Development
 | This is the forum to discuss the Wrox book Professional iPhone and iPad Application Development by Gene Backlin; ISBN: 978-0-470-87819-4 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional iPhone and iPad Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 10th, 2011, 11:12 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
Chapter 4
First foray with Xcode 4.
A cautionary note. When making the .plist in Xcode 4 there is not a visible level named "Root". The first entry should be the dictionary of the first record (i.e. Jones in example in Figure 4-11.) The same .plist in Xcode 3.x will show a "Root" level above "Jones". If an initial entry is made in the .plist in Xcode 4 of "Root" to make the file look like the figure, the program will not function correctly, since this will be read as the only key.
Two minor points.
1. There is no point in the text where the UINavigationItem IBOutlet *rootTitle is connected. The property is set and synthesized, but at no point is the MainWindow.xib opened to actually have the connection made. Without the connection the wrong title is presented in landscape mode since the string "Contacts" has been set to rootTitle which is a null pointer.
2. Listing 4-1 should be "complete DetailViewController.h" not .m and the template puts the UIPopoverController *popoverController declaration in the .m file not the .h file. so that should be omitted from the listing.
Bob
|
|

March 11th, 2011, 07:40 AM
|
|
Wrox Author
|
|
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
|
|
Ah yes, Xcode 4 :)
I have made the switch and while there is a bit of a "Where is ...", I am liking it. I am hoping Wrox will allow me to update for Xcode 4, in the meantime I am looking into video podcasts or webinars. I am scoping that out at the current moment. Stay tuned !
|
|

March 11th, 2011, 09:26 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
There may be some disorientation for readers coming to the book using Xcode 4, depending on their prior experience, since (at least through the point I am in the book) in a lot of the projects Outlets and Actions are added in Interface Builder and use File Merge rather than in the typing them in the ".h" file. I haven't really seen or done it that way since my first forays into Cocoa with Hillegass's first edition of Cocoa Programming (and Project Builder). If the reader doesn't get bent out of shape and makes the changes in the project files rather than when editing the .xib (I do not see an equivalent way to add outlets and actions in the .xib in Xcode 4 as of yet) they shouldn't encounter any issues. The main stumbling blocks will be for a reader who isn't aware that the the task can be completed that way. Unfortunately, I have seen some excellent, informative books receive poor and in some cases savage reviews (on Amazon e.g.) because screenshots didn't match, and steps to complete a task changed since Xcode evolved.
Anyway, on to Chapter 5.
Bob
|
|

March 13th, 2011, 12:16 PM
|
|
Wrox Author
|
|
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
|
|
Quote:
Originally Posted by thepianoguy
... a lot of the projects Outlets and Actions are added in Interface Builder and use File Merge rather than in the typing them in the ".h" file. I haven't really seen or done it that way since my first forays into Cocoa with Hillegass's first edition of Cocoa Programming (and Project Builder)...
|
I am an old NeXTSTEP programmer and old habits are hard to break
Quote:
Originally Posted by thepianoguy
...(I do not see an equivalent way to add outlets and actions in the .xib in Xcode 4 as of yet)...
|
It is truly amazing.... (the audio isnt there.... yet  )
Adding Outlets and Actions in Xcode 4
|
|

March 13th, 2011, 12:28 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
Found how to add the Outlets and Actions this morning. The thing that was a little frustrating was that in using it in SimpleGestureRecognizer-iPad, even with the view set to the SimpleGesturesView class identity it would only set up the automation to the â¦iPadAppDelegate. (Probably have to make a separate .xib or instantiate an NSObject in the MainWindow, but haven't tried that yet).
Also with the default setting of the instance variables with the leading underscore, have to get in the habit of typing self for all of the access. Will love typing less thoughâ¦
Bob
|
|

March 13th, 2011, 12:38 PM
|
|
Wrox Author
|
|
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
|
|
Hey Bob,
Here is what I do, especially since my clients require it
interface
Code:
UIView *_containerView;
@property (nonatomic, retain) IBOutlet UIView *containerView;
implementation
Code:
@synthesize containerView = _containerView;
This way you still have access to the variable without the underscore
Take Care,
Gene
|
|

March 13th, 2011, 12:51 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
That matches what is auto-generated. The point I was trying to make is that a line like the following in -(void)awakeFromNib on p. 184 cannot be written as
Code:
[imageView setImage:[UIImage imageNamed:@"default.png"]];
when using the autogenerated leading underscore accessors
since it generates an error "Use of undeclared identifier 'imageView', did you mean '_imageView'?
it must be either
Code:
[_imageView setImage:[UIImage imageNamed:@"default.png"]];
or
Code:
[self.imageView setImage:[UIImage imageNamed:@"default.png"]];
Bob
|
|

March 13th, 2011, 12:57 PM
|
|
Wrox Author
|
|
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
|
|
Are you saying that even if you add the @property and @synthesize as I posted above using _imageView, you still get the error ?
|
|

March 13th, 2011, 01:03 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
Yes.
The assistant generated code is
Code:
UIImageView *_imageView;
@property (nonatomic, retain) IBOutlet UIImageView *imageView;
and
Code:
@synthesize imageView = _imageView;
which generates an error if imageView is used without self.imageView or the leading underscore is omitted. It will present you with the Fixit option of adding the underscore.
Bob
|
|

March 13th, 2011, 01:09 PM
|
|
Wrox Author
|
|
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
|
|
Ahhh yes, I see what you are saying.
|
|
 |
|