I started to look into the code done by our senior, I found the init method always have code -(id)init
method. They used the code with the following ways. The code below is used for all viewControllers.
self = [super initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]];
return self;
What is the use of the if(self)
and self
in this part?
//And in some viewcontroller contains.
self = [super initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]];
if (self) {
//Do some stuff
}
return self;