If this custom NSView
is created using Interface Builder then you should override awakeFromNib
:
- (void)awakeFromNib {
[self myMainFunction];
}
Note, however, that you are ignoring the return from arrayFunction
, so it's feasible the compiler might omit the call entirely during an optmimized release build if it can determine no side effects of the call.
EDIT: Note that you need to set the NSView
-derived class within the view of the window within MainMenu.xib
, using IB, in order for this method to be triggered when the view is loaded.