开发者

calling initialization code on view which was created by loading nib from file

开发者 https://www.devze.com 2023-02-15 11:51 出处:网络
I loaded a view created by interface builder as follows: NSArray *array = [[NSBundle mainBundle] loadNibNamed:@\"MyView\" owner:self options:nil];

I loaded a view created by interface builder as follows:

NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil];
MyVie开发者_运维技巧w *myView = [array objectAtIndex:0];

The view created in the nib also has a .h and .m UIView subclass associated with it. I have initialization code within my .m source file. What is the preferred method to call initialization code?


use -awakeFromNib. This will be called the first time the class is deserialized from the nib.

0

精彩评论

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