objective c - When to use strong or weak for properties -
i have table view iboutlet
, , default xcode sets property strong
rather weak
. "recieved memory warning" message. tried change many properties strong
weak
, doesn't seem affect process , things work smoothly. should set outlets weak, or wrong?
and importantly, should set all properties nil
in viewdidunload
method, or iboutlet
s?
you should set strong
properties nil
in viewdidunload
. weak
properties automatically set nil if destination object deallocated.
iboutlet
can set strong
or weak
based on requirement.
for warning issue facing can provide more details , code?
apart link provided josh, there lot of posts on related topic, below:
weak or strong iboutlet , other
objective-c declared @property attributes (nonatomic, copy, strong, weak)
good detailed explanation can found here:
http://www.raywenderlich.com/5677/beginning-arc-in-ios-5-part-1
apple docs on topic can found here: http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/objectivec/chapters/ocproperties.html#//apple_ref/doc/uid/tp30001163-ch17-sw1
Comments
Post a Comment