首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ios 6 presentViewController

ios 6 presentViewController
EN

Stack Overflow用户
提问于 2012-11-21 07:59:10
回答 1查看 4.2K关注 0票数 1

在presentViewController中,定位不起作用。甚至我也在为UINavigationController使用分类。调用supportedInterfaceOrientations方法,但不进行任何更改。在Base中,shouldAutorotate方法返回YES。有以下代码的地方。

我正在使用这段代码.

代码语言:javascript
复制
ViewControllerOne *viewOne = [[ViewControllerOne alloc]init];

UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:viewOne];
navCtrl.modalPresentationStyle = UIModalPresentationFormSheet;

[self presentViewController:navCtrl animated:YES completion:nil];

请帮帮我。提前谢谢..。

EN

回答 1

Stack Overflow用户

发布于 2012-12-05 09:06:31

您使用的是哪个模拟器ios 5或ios 6?再发些代码。还可以看到这个link.

替换了appDelegate中的一行代码:

代码语言:javascript
复制
[window addSubview:viewController.view];

按照这一行:

代码语言:javascript
复制
[window setRootViewController:viewController];

检查iOS 5和6

代码语言:javascript
复制
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
        {
            [self presentViewController:navigationControllerCustom animated:YES completion:nil];
        }
        else
        {
            [self presentModalViewController:navigationControllerCustom animated:YES];
        }

试着使用旋转

代码语言:javascript
复制
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

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

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13488717

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档