开发者

Navigation controller in landscape, pop scrolls up

开发者 https://www.devze.com 2023-02-07 19:18 出处:网络
my app use a navigation controller and i\'m trying to insert the landscape support! I have my NavigationController and a view, that is called with an IBAction (connected at a UIButton) with this code:

my app use a navigation controller and i'm trying to insert the landscape support! I have my NavigationController and a view, that is called with an IBAction (connected at a UIButton) with this code:

view *myview = [[view alloc] initWithNibName:@"view" bundle:[NSBundle mainBundle]];
[self pushViewController:myview animated:YES];

Of course, i've imported "myview.h" in my开发者_C百科 NavigationController_Class

So, for the landscape, i've inserted this code in "myview.m" and in "NavigationController_Class.m"

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
 }

What's the problem? It works, but when you touch the button for the pop of the view from the stack, this scrolls not from the right to the left, but from up to down!

Do you know what could be the problem? thanks!


im guessing you have a UINavigationController inside a UITabBarController?

the solution is to override the shouldAutorotateToInterfaceOrientation: method of each view controller in a navigation stack (the last one is not necessary) and return YES for supported Orientations

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号