• <bdo id='WSoEs'></bdo><ul id='WSoEs'></ul>

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

    <tfoot id='WSoEs'></tfoot>

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

    1. <legend id='WSoEs'><style id='WSoEs'><dir id='WSoEs'><q id='WSoEs'></q></dir></style></legend>

      1. iOS6 中未调用 shouldAutoRotate 方法

        时间:2023-05-31

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

            <tbody id='FBWGd'></tbody>

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

        1. <legend id='FBWGd'><style id='FBWGd'><dir id='FBWGd'><q id='FBWGd'></q></dir></style></legend>

          • <tfoot id='FBWGd'></tfoot>
              • <bdo id='FBWGd'></bdo><ul id='FBWGd'></ul>

                  本文介绍了iOS6 中未调用 shouldAutoRotate 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个 UIViewController 详细视图,它是从 UINavigationController 中的 UITableView 推送的.在 UIViewController 我添加了一些子视图(例如 UITextViewUIImageView).

                  I have a UIViewController detail view which is pushed from a UITableView in a UINavigationController. In the UIViewController I add a number of subviews (e.g a UITextView, UIImageView).

                  iOS5 中,如果我的图片视图被放大,我使用此代码停止自动旋转:

                  In iOS5 I used this code to stop autorotation if my picture view was enlarged :

                  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
                  {
                  // Return YES for supported orientations
                  if (scrollView.isZoomed) {
                      return NO;
                  }
                  else {
                      return YES;
                  }
                  

                  }

                  我正在尝试在 iOS6 下使用:

                  I am trying to achieve the same thing under iOS6 using :

                  - (BOOL)shouldAutorotate {
                  return FALSE;
                  }
                  

                  然而,这个方法永远不会被调用,并且应用会继续旋转.

                  However this method is never called and the app continues rotating.

                  谁能帮忙?

                  推荐答案

                  如果您有管理这些视图的导航控制器,则不会调用 shouldAutorotate 方法.您必须继承 UINavigationController 并覆盖方法 shouldAutorotatesupportedIntervalOrientations.

                  If you have a Navigation Controller managing these views, the shouldAutorotate method won't be called. You would have to subclass UINavigationController and override methods shouldAutorotate and supportedIntervalOrientations.

                  来自文档:

                  现在,iOS 容器(例如 UINavigationController)不会咨询它们的子容器来确定它们是否应该自动旋转

                  Now, iOS containers (such as UINavigationController) do not consult their children to determine whether they should autorotate

                  编辑-----

                  正如 Lomax 下面提到的,Apple 不鼓励子类化 UINavigationController.您应该尝试一个类别(this SO question解释得很好):

                  As mentioned below by Lomax, subclassing UINavigationController is discouraged by Apple. You should try a category instead (this SO question explains it well):

                  @implementation UINavigationController 
                  -(BOOL)shouldAutorotate
                  {
                      // your code
                  }
                  
                  -(NSUInteger)supportedInterfaceOrientations
                  {
                      (...)
                  }
                  
                  @end
                  

                  这篇关于iOS6 中未调用 shouldAutoRotate 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:performSegueWithIdentifier 不起作用 下一篇:UITextField : 限制输入时允许的最大值(数字)

                  相关文章

                  最新文章

                  <legend id='pntWK'><style id='pntWK'><dir id='pntWK'><q id='pntWK'></q></dir></style></legend>
                1. <tfoot id='pntWK'></tfoot>

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