objective c - OS X how to designate startup viewcontroller -


i developing simple browser project on mac, didn't use default viewcontroller.

instead, write viewcontroller class browserviewcontroller. , write follow in appdelegate

@interface appdelegate() @property (nonatomic, strong) browserviewcontroller *browsercontroller; @end  @implementation appdelegate  - (void)applicationdidfinishlaunching:(nsnotification *)anotification {   // insert code here initialize application     self.browsercontroller = [[browserviewcontroller alloc] init];      [self.window makekeywindow];     [self.window setcontentview:self.browsercontroller.view]; }  @end 

but when app start lead default viewcontroller not browserviewcontroller. don't know reason.

thanks help, have solve problem. solution this:

- (void)applicationdidfinishlaunching:(nsnotification *)anotification { //set frame of window fit device's frame // self.window = [[nswindow alloc] initwithcontentrect:[[nsscreen     mainscreen] frame] stylemask:nsborderlesswindowmask     backing:nsbackingstorebuffered defer:no ];  // // self.browsercontroller = [[browserviewcontroller alloc] init];   //set contentview // self.window.contentviewcontroller = self.browsercontroller;  //this setting global backgroundcolor of window // self.window.backgroundcolor = [nscolor whitecolor];  //this means window window receive user interaction. // [self.window makekeyandorderfront:self]; //[self.window makekeywindow];//note: not working. } 

you can select is initial controller in storyboard.

storyboard


Comments