Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to release IBOutlet object?

I have dilemma about Memory releasing IBOutlet object.Do anyone please suggest what to do when we create IBOutlet object without property, need to release it?? if need to release... why we are releasing it

like image 322
SachinVsSachin Avatar asked Feb 18 '23 18:02

SachinVsSachin


2 Answers

The answer is YES.

The runtime connects the objects to IBOutlet using [setValue:ForKey:]. This function will find the private instance variables, retain the target and set it to the instance variable. Please visit here iOS Developer Library to know more.

I highly recommend you to read the article because many iOS framework accesses properties by Key-Value compliance ([setValue:ForKey:] or [valueForKey:]), instead of directly calling getters/setters/instance variables.

like image 159
HKTonyLee Avatar answered Feb 27 '23 11:02

HKTonyLee


IBOutlet does not change the ownership semantics of properties. If you do not use ARC you have to release retained objects as with any other property.

like image 33
Nikolai Ruhe Avatar answered Feb 27 '23 11:02

Nikolai Ruhe