Iphone u导航控制器不';t以横向模式打开
我正在以以下方式加载Iphone u导航控制器不';t以横向模式打开,iphone,ios,uiview,uinavigationcontroller,cocos2d-iphone,Iphone,Ios,Uiview,Uinavigationcontroller,Cocos2d Iphone,我正在以以下方式加载UIViewController: -(void)logIn { NewSignInView *viewController = [[[NewSignInView alloc] init] autorelease]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; [s
UIViewController
:
-(void)logIn
{
NewSignInView *viewController = [[[NewSignInView alloc] init] autorelease];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self presentModalViewController:navController animated:YES];
[navController release];
[UIView animateWithDuration:0.3
delay:0
options:UIViewAnimationCurveEaseOut
animations:^{ self.view.alpha = 0; }
completion:^(BOOL finished){ }];
}
NewSignView
是一个UIViewController
,它创建一个UITableView
来获取用户的输入。当我使用UINavigationController
加载它时,它拒绝在横向模式下打开。但是,如果我直接将其加载到CCDirector
中,它将以如下方式在横向中正确打开
[[[CCDirector sharedDirector] openGLView] addSubview:viewController.view];
我在NewSignInView
中使用了以下内容:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
因此,有东西阻止了UINavigationController
在横向模式下打开。有人能帮我找出问题的原因吗
谢谢在您的shouldAutorotateToInterfaceOrientation中尝试以下方法:
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
因此,控制器支持两种旋转,而不仅仅是景观。
确保带有logIn方法的ViewController在shouldAutorotateToInterfaceOrientation中返回YES
希望这有帮助。
此外,我想提出一个建议:不要在没有控制器的情况下命名ViewController NewSignenView,以免混淆。如果这只是一个快速而肮脏的例子——没关系
问候