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.
精彩评论