When using ARC there is no need to use modifiers like retain
or copy
, for example. That kind of memory managment is done automatically using the strong
and weak
modifiers.
You also don't have to worry about writing dealloc
methods.
strong
is kind of the equivalent of retain
, so you should mark your outlets with it
@property(nonatomic, strong) IBOutlet UIButton *bt;
That's the way interface builder creates them by default.
I won't go into detail about their semantic differences, but you should really have a look at Apple's guide on transitioning to ARC if you want to know what's going on and read about the specifics of strong
and weak
modifiers.
EDIT:
Sorry, interface builder creates outlets with weak
by default.
EDIT 2:
strong
and retain
are indeed 100% identical. (thanks to @Adam)
EDIT 3:
You set your pointers to nil
to avoid getting any message sent to deallocated instance
or BAD_ACCESS_EXCEPTION
errors.
If you are actually using ARC, you should make your outlets (nonatomic, weak)
instead of (nonatomic, strong)
. By using the weak
zeroing pointers, what the compiler does is automatically set your outlets to nil
when nothing else references them.
So, summing up, if you don't use weak
properties, you should set your pointers to nil.