• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing interface elements (iPhone vs Mac)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing interface elements (iPhone vs Mac)


  • Subject: Re: Accessing interface elements (iPhone vs Mac)
  • From: mmalc Crawford <email@hidden>
  • Date: Tue, 20 Jan 2009 18:50:48 -0800


On Jan 20, 2009, at 12:41 PM, Ashley Perrien wrote:

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.


This should actually be

@interface MyViewController : UIViewController
{
    UILabel *myLabel;
}
@property (retain, nonatomic) IBOutlet UILabel *myLabel;

The advantage of this approach is that it makes the memory management semantics explicit and clear, and it works consistently across all platforms for all nib files.

<http://stackoverflow.com/questions/61838>


mmalc

_______________________________________________

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


  • Follow-Ups:
    • Re: Accessing interface elements (iPhone vs Mac)
      • From: mmalc Crawford <email@hidden>
References: 
 >Accessing interface elements (iPhone vs Mac) (From: Ashley Perrien <email@hidden>)

  • Prev by Date: Re: Accessing interface elements (iPhone vs Mac)
  • Next by Date: Re: Accessing interface elements (iPhone vs Mac)
  • Previous by thread: Re: Accessing interface elements (iPhone vs Mac)
  • Next by thread: Re: Accessing interface elements (iPhone vs Mac)
  • Index(es):
    • Date
    • Thread