What is the difference between retain & assign?

Answer

Assign creates a reference from one object to another without increasing the source’s retain count.

if (_variable != object)

{   

 [_variable release];  

  _variable = nil;  

  _variable = object;

 }

Retain creates a reference from one object to another and increases the retain count of the source object.

if (_variable != object)

{

  [_variable release];

    _variable = nil;  

_variable = [object retain];  

}

All ios Questions

Ask your interview questions on ios

Write Your comment or Questions if you want the answers on ios from ios Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---