• 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
Rules for IBOutlet Strong/Weak References
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: scrollPoint in NSScrollView does not scroll
  • Next by Date: Re: scrollPoint in NSScrollView does not scroll
  • Previous by thread: Animating constraints iOS
  • Next by thread: view gets drawRect called when scrolling into elastic area
  • Index(es):
    • Date
    • Thread