Accessing interface elements (iPhone vs Mac)
Accessing interface elements (iPhone vs Mac)
- Subject: Accessing interface elements (iPhone vs Mac)
- From: Ashley Perrien <email@hidden>
- Date: Tue, 20 Jan 2009 14:41:57 -0600
I'm currently fairly comfortable with Mac development but still
struggling to learn iPhone. I'm seeing differences in how things are
coded and I'm not seeing many explanations as to why the difference.
For instance, on the Mac, in Interface Builder, I have a text field, I
link it up with the code using:
@interface someClass : NSObject
{
IBOutlet NSTextField *myLabel;
}
Then in the implementation I can call [myLabel setStringValue:
@"something new"]. No need to create the methods, alloc, init or
release anything, etc.
In iPhone examples many or all of them have:
@interface myViewController : UIViewController
{
IBOutlet UILabel *myLabel;
}
@property (retain, nonatomic) UILabel *myLabel;
and then @synthesize myLabel in the implementation. I've even seen
where the dealloc method will then release the object.
I believe I've tried it and the property and synthesize are not
NECESSARY for it all to work; so is having it in there of some kind of
benefit for the iPhone or is it just a quirk of how developer X likes
to do things? I've seen some discussions about how the autorelease
pool shouldn't be used as much on the iPhone and ideally you should
alloc and then later release things for tighter memory control. That
makes sense. Is there something similar with the above, is there a
back-end reason to property, synthesize and release things that were
created in IB?
Ashley Perrien
Random Quote of the day:
"One way to get high blood pressure is to go mountain climbing over
molehills."
-Earl Wilson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden