• <small id='R1Vzv'></small><noframes id='R1Vzv'>

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

      <legend id='R1Vzv'><style id='R1Vzv'><dir id='R1Vzv'><q id='R1Vzv'></q></dir></style></legend>
    1. <tfoot id='R1Vzv'></tfoot>
        <bdo id='R1Vzv'></bdo><ul id='R1Vzv'></ul>
      1. 一个视图控制器ios的强制横向

        时间:2023-06-12
      2. <tfoot id='rpip4'></tfoot>

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

                  <tbody id='rpip4'></tbody>

                <legend id='rpip4'><style id='rpip4'><dir id='rpip4'><q id='rpip4'></q></dir></style></legend>
                  <bdo id='rpip4'></bdo><ul id='rpip4'></ul>

                • <i id='rpip4'><tr id='rpip4'><dt id='rpip4'><q id='rpip4'><span id='rpip4'><b id='rpip4'><form id='rpip4'><ins id='rpip4'></ins><ul id='rpip4'></ul><sub id='rpip4'></sub></form><legend id='rpip4'></legend><bdo id='rpip4'><pre id='rpip4'><center id='rpip4'></center></pre></bdo></b><th id='rpip4'></th></span></q></dt></tr></i><div id='rpip4'><tfoot id='rpip4'></tfoot><dl id='rpip4'><fieldset id='rpip4'></fieldset></dl></div>
                • 本文介绍了一个视图控制器ios的强制横向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我查看了几个类似问题的答案,但没有一个答案有效.我有一个应用程序,除了我拥有的一个照片查看器之外,我需要所有肖像.在目标菜单的支持方向部分中,我只有纵向.我如何强制我的一种观点是风景.它正在从导航控制器推入堆栈,但我正在使用情节提要来控制这一切.

                  I've looked at several answers to questions similar but none of the answer worked. I have an app where I need everything portait except for one photo viewer I have. In the supported orientations section of the targets menu I only have portrait. How do I force my one view to be landscape. It is being pushed onto the stack from a nav controller but I'm using storyboards to control all that.

                  推荐答案

                  由于答案似乎隐藏在问题的评论中,并且由于 ArunMak 的答案相当混乱,所以我将提供我发现的内容:

                  Since the answer seems to be hidden in the comments of the question and since ArunMak's answer is quite confusing, I'll just offer what I found out:

                  我所要做的就是将此函数添加到视图的自定义 UIViewController 子类中:

                  All I had to do was to add this function to my custom UIViewController subclass for the view:

                  - (NSUInteger)supportedInterfaceOrientations {
                      if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
                          // iPad: Allow all orientations
                          return UIInterfaceOrientationMaskAll;
                      } else {
                          // iPhone: Allow only landscape
                          return UIInterfaceOrientationMaskLandscape;
                      }
                  }
                  

                  请注意,该项目需要允许所有方向(即:纵向、左侧横向、右侧横向 - 但在 iPhone 上切勿颠倒!).

                  Note that the project needs to allow all orientations (that is: Portrait, Landscape Left, Landscape Right - but NEVER Upside Down on an iPhone!).

                  如果您想将部分或大部分视图限制为 Portrait,则需要在每个视图控制器中实现上述方法(或为其使用公共超类并从其子类化所有其他视图)——如果您限制 DeviceInfo.plist 中的方向只是纵向,应用程序永远不会考虑进入横向.

                  If you want to limit some or most views to Portrait, you need to implement the above method in every of those view controllers (or use a common super class for it and subclass all others from it) — if you limit the Device Orientation in the Info.plist to just Portrait, the app will never even think of going into landscape.

                  这篇关于一个视图控制器ios的强制横向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:UINavigationItem titleView“如果设置了leftBarButtonItem则忽略"? 下一篇:Swift导航栏背景颜色白色不起作用

                  相关文章

                    <tfoot id='Im8jh'></tfoot>

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

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