Rules for IBOutlet Strong/Weak References
Rules for IBOutlet Strong/Weak References
- Subject: Rules for IBOutlet Strong/Weak References
- From: Gordon Apple <email@hidden>
- Date: Mon, 17 Jun 2013 10:28:38 -0500
- Thread-topic: Rules for IBOutlet Strong/Weak References
Re: Confused by memory issue with UIDatePicker
I¹ve had a lot of experience with this and would like to share my basic
rules for IBOutlets when using ARC. This should be fairly obvious, but I
think it needs saying.
1. All top level objects in a nib should be strongly-referenced from the
file¹s owner, or from another such strongly-referenced top-level object.
(Could be more than one if you can ensure no reference cycles.) Otherwise,
said object will disappear immediately after nib loading.
2. All other outlets, including back to the file¹s owner, should be weak,
to prevent retain cycles.
Hopefully, this covers all cases. (I¹m sure someone will let me know if it
doesn¹t. :-)
_______________________________________________
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