• 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: Adam Venturella <email@hidden>
  • Date: Wed, 21 Jan 2009 10:28:48 -0800

Answered my own question re the dealloc here:

Important: You are responsible for releasing the top-level objects of
any nib files you load when you are finished with those objects.
Failure to do so is a cause of memory leaks in many applications.
After releasing the top-level objects, it is a good idea to clear any
outlets pointing to objects in the nib file by setting them to nil.
You should clear outlets associated with all of the nib file's
objects, not just the top-level objects.

http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/chapter_3_section_6.html#//apple_ref/doc/uid/10000051i-CH4-SW30


On Wed, Jan 21, 2009 at 10:25 AM, Adam Venturella <email@hidden> wrote:
> I have seen this same behavior too, creating @properties for IBOutlets
> on the iPhone.  I have yet to run into a problem not
> @property/@synthsizeing my Outlets on the iPhone, everything seems to
> work just fine if you don't.  So am I missing something?  And am I
> correct in assuming you would then be responsible for [myOutlet
> release] in the dealloc?
>
>
> On Wed, Jan 21, 2009 at 10:04 AM, Shawn Erickson <email@hidden> wrote:
>> On Tue, Jan 20, 2009 at 5:30 PM, Graham Cox <email@hidden> wrote:
>>
>>> When the nib is loaded, the accessor is used rather than setting the ivar directly (as per Mac)
>>
>> To be clear NIB loading on Mac OS X will use a setter if one exists
>> (assuming a name match)...
>>
>> Outlet connections
>> In Mac OS X, the nib-loading code tries to reconnect outlets using the
>> object's own methods first. For each outlet, Cocoa looks for a method
>> of the form setOutletName: and calls it if such a method is present.
>> If it cannot find such a method, Cocoa searches the object for an
>> instance variable with the corresponding outlet name and tries to set
>> the value directly. If the instance variable cannot be found, no
>> connection is created.
>> ...
>>
>> So if you are targeting Mac OS X 10.5 and later you can use the same
>> property syntax as you see on the iPhone ... the same consistent
>> pattern will support both.
>>
>> -Shawn
>> _______________________________________________
>>
>> 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
>>
>
_______________________________________________

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

References: 
 >Accessing interface elements (iPhone vs Mac) (From: Ashley Perrien <email@hidden>)
 >Re: Accessing interface elements (iPhone vs Mac) (From: Graham Cox <email@hidden>)
 >Re: Accessing interface elements (iPhone vs Mac) (From: Shawn Erickson <email@hidden>)
 >Re: Accessing interface elements (iPhone vs Mac) (From: Adam Venturella <email@hidden>)

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