ios - how do I set the orientation of a UIWindow with UINavigation -


i'm adding following code application in order navigate , forth quicklook view.

window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];  [self rotateview]; nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:self];  [window addsubview:[nav view]]; [window makekeyandvisible];  [[self navigationcontroller] setnavigationbarhidden:yes]; 

this code run in main viewcontroller viewdidload function. application runs in landscape window , navigation bar loads in portrait mode. application doesn't have statusbar code i've found doesn't work. error if try check , listen status bar orientation notifications.

i'm looking way allow navigation view set it's orientation based on apps current orientation.

if understand question above code should placed in didfinishlaunchingwithoptions not in viewdidload in appdelegate , initialization of mainviewcontroller should there also.

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     self.window = [[[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease];     // override point customization after application launch.     self.mainviewcontroller = //init mainviewcontroller;     navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:(uiviewcontroller*)viewcontroller];     [window addsubview:navigationcontroller.view];     [self.window makekeyandvisible];     return yes; } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -