开发者

Custom Initializer when ViewController is loaded from NibFile

I have a UISplitViewController in a xib file that contains two custom UIViewControllers. I put most of my initialization code in the viewDidLoad: method, but I don't think thats where it should be.

What method can I override so that my code will be run when the xib is 开发者_如何学Pythoninflated?

Thanks in advance, and let me know if you require any clarification.


Use - (void)awakeFromNib. Another option is -(id)initWithCoder: but I would recommend the awakeFromNib.

An awakeFromNib message is sent to each object loaded from the archive, but only if it can respond to the message, and only after all the objects in the archive have been loaded and initialized. When an object receives an awakeFromNib message, it is guaranteed to have all its outlet instance variables set.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜