I am new in objective c. I understand that -init() is an instance method and return an object
e.g. myObj=[myObj init]; will return an object myObj.
However, if self =[super init]; normally super refer to parent class e.g. NSObject which is a class, not instance.
So, Is -init() instance method or class method for super init?
thanks
initis an instance method. The fact that you call it onsuperdoes not change it.Keep in mind that
superdoes not represent the class of your object, but your object seen as an instance of its parent class in the class hierarchy.And you never call
myObj=[myObj init];— you callmyObj = [[MyObj alloc] init]. Notice the case difference betweenmyObj(a variable) andMyObj(the class of which this variable is an instance).