Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone u导航控制器不';t以横向模式打开_Iphone_Ios_Uiview_Uinavigationcontroller_Cocos2d Iphone - Fatal编程技术网

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,以免混淆。如果这只是一个快速而肮脏的例子——没关系

问候