why does the init-method of a custom nib-based table cell not get called

若如初见. 提交于 2019-12-05 04:36:41
Joshua Weinberg

When being unarchived initialization goes through a slightly different path.

Instead of -(id)init being called -(id)initWithCoder:(NSCoder*)aDecoder will be called. At this point outlets aren't hooked up, if you need access to the outlets you can override -(void)awakeFromNib which will be called after the object has been hooked up.

Vladimir

When object is being loaded from nib file then its -awakeFromNib method is called - you can put your initialisation code there:

- (void)awakeFromNib{
   // Init code
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!