What is the difference between retain & assign?
7088
02-Aug-2015
Updated on 24-Sep-2020
Tarun Kumar
02-Aug-2015if (obj1 != ob2) {[obj1 release];
obj1 = nil;
obj1 = obj2; }
Retain creates a reference from one object to another and increases the retain count of the source object.
if (obj1 != obj2) {[obj1 release];
obj1 = nil;
obj1 = [obj2 retain]; }