相关疑难解决方法(0)

shouldAutorotateToInterfaceOrientation未在iOS 6中调用

我正在使用MGSplitViewController,我shouldAutorotateToInterfaceOrientation用来控制旋转时主视图控制器的大小.

它在iOS 5上运行良好,但在iOS 6(模拟器和iPad)shouldAutorotateToInterfaceOrientation上从未调用过.

这是一个我应该期望在iOS 6的最终版本中修复的错误或者我不知道已经改变的东西吗?

orientation ios ios6

61
推荐指数
8
解决办法
9万
查看次数

iOS 6中的自动旋转具有奇怪的行为

我有UITabBarControllerapp播放视频并在其他UITabBar标签中显示其他信息.在iOS 6中,UIView不推荐使用旋转方法,现在我需要使用shouldAutoRotatesupportedInterfaceOrientations方法.对于视频播放,我使用MPMoviePlayerViewController.

如何仅旋转此播放器视图?我只能旋转整个应用程序,但不想这样做.我提出MPMoviePlayerViewController但它不像iOS 5及更早版本那样旋转.

plist设置中我只设置了1个人像界面方向.如果我设置其他 - 整个应用程序将被轮换.

iphone objective-c mpmovieplayercontroller ios ios6

28
推荐指数
3
解决办法
4万
查看次数

如何使应用程序在iOS 6中完全正常工作以进行自动旋转?

在iOS6中,shouldAutorotateToInterfaceOrientation已弃用.我尝试使用 supportedInterfaceOrientationsshouldAutorotate 使应用程序正常工作自动旋转但失败了.

这个ViewController我不想旋转,但它不起作用.

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

-(BOOL)shouldAutorotate
{
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?在此先感谢您的帮助!

uiviewcontroller autorotate ios ios6

17
推荐指数
1
解决办法
2万
查看次数

iOS 6轮换问题 - 从提供的模态视图控制器无法轮换

我有一个MainViewController,它有一个按钮,通过翻转horizo​​ntailly推动一个新的视图(InfoViewController).像这样:

controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
Run Code Online (Sandbox Code Playgroud)

MainView控制器支持Portrait和PortraitUpsideDown.像这样:

- (BOOL)shouldAutorotate {
    return YES;    
}

- (NSUInteger)supportedInterfaceOrientations {    
    return (UIInterfaceOrientationMaskPortrait | 
            UIInterfaceOrientationMaskPortraitUpsideDown);
}
Run Code Online (Sandbox Code Playgroud)

在我的InfoViewController中,它还说明了上面的代码.在我的AppDelegate中,它在LaunchOptions中有这个:

[self.window setRootViewController:self.mainViewController];
Run Code Online (Sandbox Code Playgroud)

在我的app.plist文件中,它支持所有方向.这是因为其他观点也需要支持景观.所以在我的MainViewController和InfoViewController上我只需要Portrait和PortraitUpsideDown.但另一种观点我需要所有的观点.

我的MainViewController工作正常,但我的InfoViewController适用于所有方向.

我正在努力让这个在iOS6中运行起来.我已经研究了其他帖子,并尝试过其他人提供的帮助,但没有任何运气.请有人帮助我实现这一点谢谢.我是Objective-C的新手:p

objective-c ios ios6

16
推荐指数
1
解决办法
2万
查看次数

力量景观ios 7

我试图按照方法强制观察我的观点:

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationLandscapeLeft;
}

- (BOOL)shouldAutorotate{
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

两者都没有奏效.请注意,我正在模拟器和iPad上进行测试.

谢谢

landscape viewcontroller ios ios7

10
推荐指数
2
解决办法
1万
查看次数

如何在使用故事板时继承Navigation Controller?

我在界面构建器中使用故事板使用Xcode菜单'Editor ... Embed in ... Navigation Controller'.

似乎在iOS 6中你必须将UINavigationController子类化为允许所有方向

- (NSUInteger)supportedInterfaceOrientations {
    return (UIInterfaceOrientationMaskAll   );
}
Run Code Online (Sandbox Code Playgroud)

但是,如何将UINavigationController与故事板应用程序子类化,因为代码中没有对它的引用?

iphone storyboard uinavigationcontroller subclassing uiinterfaceorientation

8
推荐指数
1
解决办法
3637
查看次数

强制iOS视图不旋转,同时仍允许子项旋转

我有一个带有子视图控制器的视图控制器.

tab bar controller
|
|
nav controller
|
|
UIPageViewController (should rotate)
|
|
A (Video Player) (shouldn't rotate)
|
|
B (Controls overlay) (should rotate)
Run Code Online (Sandbox Code Playgroud)

应该强制A始终保持纵向,但应允许B自由旋转.

我知道shouldAutorotate适用于任何视图控制器及其子级,但有没有办法解决这个问题?好像我可以使用shouldAutorotateToInterfaceOrientation,但这在iOS 8中被阻止了.

我想保持视频播放器静态(因此水平视频始终是水平的,无论设备方向如何),而控制层子视图覆盖允许自由旋转.

我正在使用Swift.

uiviewcontroller autorotate ios swift

8
推荐指数
1
解决办法
4334
查看次数

iOS错误:支持的方向与应用程序(iPhone)没有共同的方向

使用iOS 8.3

我在横向模式下有一个视图,我正在尝试打开一个仅限肖像的视图控制器.每次我尝试打开它,应用程序崩溃.

我已经阅读了这个官方的苹果答案,基本上建议做以下事情:

在app委托中:

@implementation AppDelegate

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        return UIInterfaceOrientationMaskAll;
    else  /* iphone */
        return UIInterfaceOrientationMaskAllButUpsideDown;
} 
Run Code Online (Sandbox Code Playgroud)

在我的控制器中:

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}
Run Code Online (Sandbox Code Playgroud)

所以我有,但我仍然得到这个崩溃消息:

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES
Run Code Online (Sandbox Code Playgroud)

在项目常规设置中,我有以下(不应根据苹果的答案进行更改):

设置

我可以看到这些函数实际上被调用但没有任何帮助.有什么想法吗?

我之前读过的一些问题:

如何在iOS 6中强制UIViewController为Portrait方向

iOS6:supportedInterfaceOrientations不工作(调用但接口仍然旋转)

支持的方向与应用程序没有共同的方向,shouldAutorotate返回YES'

iphone objective-c uiimagepickercontroller ios

5
推荐指数
1
解决办法
1万
查看次数

IO6不调用 - (BOOL)shouldAutorotate

我在我的应用程序中有一些观点,我不想支持方向.在didFinishLaunchingWithOptions我添加导航:

...
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:self.viewController];

    self.window.rootViewController = nav;
    [self.window makeKeyAndVisible];
...
Run Code Online (Sandbox Code Playgroud)

在每一个ViewControllerUITabBar(我不知道这是否重要).

在第一个视图控制器中我添加:

-(BOOL)shouldAutorotate {
        return NO;
    }

    - (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskPortrait;
    }
Run Code Online (Sandbox Code Playgroud)

supportedInterfaceOrientations在视图加载时shouldAutorotate调用,但在旋转设备时不调用.
我在这里错过了什么?

iphone objective-c uiinterfaceorientation ios ios6

2
推荐指数
1
解决办法
5705
查看次数