Let's say I have two properties defined as such:
@property (nonatomic, strong) UITableView *parentTableView;
@property (nonatomic, strong) NSMutableArray *headersArray;
and method:
-(void)prepareTags;
and say I have an init method like this:
-(id)initWithParentTableView:(UITableView*)parentTable
{
if(self = [super init])
{
NSMutableArray *array = [[NSMutableArray alloc] init];
headersArray = array;
self.parentTableView = parentTable;
[self prepareTags];
}
return self;
}
- Is this the correct way to set up an array of headers in the init method?
- Am I allowed to call
self.parentTableViewfrom an init method? - I am allowed to call a method from the init method (in this case, the prepareTags method calls
self). Will it be ready selfto use even if the init method has not yet returned?
source
share