I have a subclass of NSViewController that loads its view from nib (with initWithNibName: bundle: and is the owner of this nib file).
I need to do some initialization after loading nib, and I want my code to be the most compatible:
- In ios: there is a viewDidLoad method for this
- In osx: the snow leopard does not have a method such as viewDidLoad, but awakeFromNib is called on the owner of the file with the inscription
So my questions are:
- Is awakeFromNib also called the owner of the nib file in Lion?
- If I use awakeFromNib, do I need to call [super awakeFromNib]? (NSViewController implements awakeFromNib?)
- If answer 1 is YES, is that a good solution?
- (void)initAfterNibLoaded { ... } - (void)viewDidLoad { // Code for ios [self initAfterNibLoaded]; } - (void)awakeFromNib { // Code for osx // Not sure if necessary [super awakeFromNib]; [self initAfterNibLoaded]; }
If answer 1 is NO, is that a good solution?
- (void)viewDidLoad {
thanks
initialization ios nsviewcontroller macos awakefromnib
Johnmph
source share