Re: Confused by memory issue with UIDatePicker
Re: Confused by memory issue with UIDatePicker
- Subject: Re: Confused by memory issue with UIDatePicker
- From: Kyle Sluder <email@hidden>
- Date: Sun, 16 Jun 2013 17:29:00 -0700
On Sun, Jun 16, 2013, at 05:00 PM, Daniel Wambold wrote:
> Quincey Morris wrote:
> >
> >> I have a UIDatePicker in an .xib file with its File's Owner set to a custom class, MyTimeDatePickerVC. The MyTimeDatePickerVC inherits from UIViewController, and has an IBOutlet attached to the UIDatePicker.
> >
> > What does the IBOutlet declaration for the UIDatePicker look like?
> >
> >
>
> @interface MyTimeDatePickerVC : UIViewController <UITableViewDelegate,
> UITableViewDataSource>
> {
> IBOutlet UIDatePicker *myTimeDatePickerUI;
>
> The connection is shown in the margin as the circle with a central dot,
> as expected, and on inspection, it shows it's connected to the
> MyDateTimePickerVC~iphone's Picker.
From "Managing Nib Objects in iOS", in the Legacy Patterns section of
the Nib Files chapter of the Resource Programming Guide
<http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW19>:
"""As it rebuilds the object hierarchy, UIKit reestablishes connections
between the objects using setValue:forKey:, which uses the available
setter method or retains the object by default if no setter method is
available. This means that (assuming you follow the pattern shown above)
any object for which you have an outlet remains valid."""
For this reason, that document recommends you use a weak declared
property for outlets to non-top-level objects. You should probably
follow that recommendation.
--Kyle Sluder
_______________________________________________
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