1. <i id='g5B8r'><tr id='g5B8r'><dt id='g5B8r'><q id='g5B8r'><span id='g5B8r'><b id='g5B8r'><form id='g5B8r'><ins id='g5B8r'></ins><ul id='g5B8r'></ul><sub id='g5B8r'></sub></form><legend id='g5B8r'></legend><bdo id='g5B8r'><pre id='g5B8r'><center id='g5B8r'></center></pre></bdo></b><th id='g5B8r'></th></span></q></dt></tr></i><div id='g5B8r'><tfoot id='g5B8r'></tfoot><dl id='g5B8r'><fieldset id='g5B8r'></fieldset></dl></div>
  2. <small id='g5B8r'></small><noframes id='g5B8r'>

    <legend id='g5B8r'><style id='g5B8r'><dir id='g5B8r'><q id='g5B8r'></q></dir></style></legend>
    <tfoot id='g5B8r'></tfoot>

        <bdo id='g5B8r'></bdo><ul id='g5B8r'></ul>
    1. presentViewController 在 iOS 6 中不支持方向

      presentViewController not supporting orientation in iOS 6(presentViewController 在 iOS 6 中不支持方向)
              <bdo id='11Msm'></bdo><ul id='11Msm'></ul>

              <small id='11Msm'></small><noframes id='11Msm'>

              <i id='11Msm'><tr id='11Msm'><dt id='11Msm'><q id='11Msm'><span id='11Msm'><b id='11Msm'><form id='11Msm'><ins id='11Msm'></ins><ul id='11Msm'></ul><sub id='11Msm'></sub></form><legend id='11Msm'></legend><bdo id='11Msm'><pre id='11Msm'><center id='11Msm'></center></pre></bdo></b><th id='11Msm'></th></span></q></dt></tr></i><div id='11Msm'><tfoot id='11Msm'></tfoot><dl id='11Msm'><fieldset id='11Msm'></fieldset></dl></div>

                <tbody id='11Msm'></tbody>
              <tfoot id='11Msm'></tfoot>
            • <legend id='11Msm'><style id='11Msm'><dir id='11Msm'><q id='11Msm'></q></dir></style></legend>

                本文介绍了presentViewController 在 iOS 6 中不支持方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用此代码

                if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
                    {
                        [self presentViewController:navigationControllerCustom animated:YES completion:nil];
                    }
                    else
                    {
                        [self presentModalViewController:navigationControllerCustom animated:YES];
                    }
                

                我的应用程序有两个方向纵向和纵向倒置.此代码适用于 iOS 5.1,但方向不适用于 iOS 6

                My application has two orientation Portrait and Portrait upside down. This code works well with iOS 5.1, but orientation does not work on iOS 6

                我还在 navigationControllerCustom 类中添加了这段代码

                I have also added this code on my navigationControllerCustom class

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

                请帮我解决这个问题.

                提前致谢.

                推荐答案

                你必须在你的应用程序委托中包含这个:

                You must include this in you application delegate:

                - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
                    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
                }
                

                还要确保视图控制器都具有以下内容,对我来说可以正常工作.

                Also make sure the View Controller's both have the following, works fine for me.

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

                文档还说 UINavigationController's 不会查询其顶部视图控制器以获取支持的方向,尽管开发者论坛上的苹果工程师确实这么说......似乎它没有.因此,您应该为 UINavigationController 添加一个类别,这是我使用的:

                The documentation also says that UINavigationController's doesn't query its top View Controller for orientations supported, although an Apple engineer over on the Developer Forums did say so... it seems that it does not. Therefore you should add a category for UINavigationController, this is the one I use:

                #import "UINavigationController+autorotate.h"
                
                @implementation UINavigationController (autorotate)
                
                - (NSUInteger)supportedInterfaceOrientations{
                    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
                }
                
                @end
                

                有关 AutoRotate 如何在 iOS 6 上工作的更多信息查看此答案

                For more information how AutoRotate works on iOS 6 check out this answer

                这篇关于presentViewController 在 iOS 6 中不支持方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                How to add a navigation controller programmatically in code but not as initial view controller(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)

                <small id='LtB6u'></small><noframes id='LtB6u'>

                <i id='LtB6u'><tr id='LtB6u'><dt id='LtB6u'><q id='LtB6u'><span id='LtB6u'><b id='LtB6u'><form id='LtB6u'><ins id='LtB6u'></ins><ul id='LtB6u'></ul><sub id='LtB6u'></sub></form><legend id='LtB6u'></legend><bdo id='LtB6u'><pre id='LtB6u'><center id='LtB6u'></center></pre></bdo></b><th id='LtB6u'></th></span></q></dt></tr></i><div id='LtB6u'><tfoot id='LtB6u'></tfoot><dl id='LtB6u'><fieldset id='LtB6u'></fieldset></dl></div>
                  <bdo id='LtB6u'></bdo><ul id='LtB6u'></ul>
                • <tfoot id='LtB6u'></tfoot>
                      <legend id='LtB6u'><style id='LtB6u'><dir id='LtB6u'><q id='LtB6u'></q></dir></style></legend>

                          <tbody id='LtB6u'></tbody>