<tfoot id='JjZjO'></tfoot>

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

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

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

        以编程方式设置提示时,UINavigationBar 与 UITableView 重叠

        UINavigationBar overlaps UITableView when programmatically setting prompt(以编程方式设置提示时,UINavigationBar 与 UITableView 重叠)

      1. <small id='aJUy4'></small><noframes id='aJUy4'>

              <legend id='aJUy4'><style id='aJUy4'><dir id='aJUy4'><q id='aJUy4'></q></dir></style></legend>
            • <tfoot id='aJUy4'></tfoot>

                <tbody id='aJUy4'></tbody>
              <i id='aJUy4'><tr id='aJUy4'><dt id='aJUy4'><q id='aJUy4'><span id='aJUy4'><b id='aJUy4'><form id='aJUy4'><ins id='aJUy4'></ins><ul id='aJUy4'></ul><sub id='aJUy4'></sub></form><legend id='aJUy4'></legend><bdo id='aJUy4'><pre id='aJUy4'><center id='aJUy4'></center></pre></bdo></b><th id='aJUy4'></th></span></q></dt></tr></i><div id='aJUy4'><tfoot id='aJUy4'></tfoot><dl id='aJUy4'><fieldset id='aJUy4'></fieldset></dl></div>
                <bdo id='aJUy4'></bdo><ul id='aJUy4'></ul>
                • 本文介绍了以编程方式设置提示时,UINavigationBar 与 UITableView 重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 UINavigationController,其中包含一个 UITableViewController.这个导航控制器会推动其他 UITableViewControllers,最终这些表格视图控制器会有提示.

                  I have a UINavigationController which contains a UITableViewController. This navigation controller pushes other UITableViewControllers around and eventually these table view controllers will have a prompt.

                  问题是当我以编程方式设置此提示时,它会与它下面的表格视图的内容重叠.

                  The problem is when I set this prompt programmatically it overlaps the content of the table view underneath it.

                  (搜索栏被导航栏隐藏)

                  (A search bar is being hidden by the navigation bar)

                  我在 SO 中环顾四周,发现 这个答案.我在受影响的视图控制器中以两种不同的方式尝试了该建议,但没有任何改变:

                  I was looking around in SO and found this answer. I tried the suggestion there in two different ways in the affected view controller but nothing changed:

                  override func viewDidLoad() {
                      super.viewDidLoad()
                      self.edgesForExtendedLayout = .None;
                      self.extendedLayoutIncludesOpaqueBars = false;
                      self.navigationItem.title = NSLocalizedString("Add Anime or Manga", comment: "")
                      self.navigationItem.prompt = NSLocalizedString("Search media belonging to this series.",  comment: "")
                  }
                  

                  -

                  override func viewDidLoad() {
                      super.viewDidLoad()
                      self.navigationItem.title = NSLocalizedString("Add Anime or Manga", comment: "")
                      self.navigationItem.prompt = NSLocalizedString("Search media belonging to this series.",  comment: "")
                      self.edgesForExtendedLayout = .None;
                      self.extendedLayoutIncludesOpaqueBars = false;
                  }
                  

                  同一答案中的评论链接到 此 Apple 指南 关于防止视图相互重叠.问题是 UITableViewController 似乎没有顶部/底部布局指南,因此我无法创建约束(another SO answer 说在表格视图控制器中使用上述布局是无关紧要的).

                  A comment in that same answer linked to this Apple guide on preventing views from overlapping each other. The problem is UITableViewController doesn't appear to have top/bottom layout guides so I can't create a constraint (another SO answer says having said layouts in table view controllers is irrelevant).

                  因此,我已经用尽了所有选择.

                  As such I have exhausted all my options.

                  推荐答案

                  我已尝试重现您的问题,但似乎并非所有 viewControllers 都有提示 navigationBar 以某种方式无法正确调整大小.

                  I have tried to reproduce your problem and it seems that when not all the viewControllers have a prompt the navigationBar is somehow not resizing properly.

                  您似乎需要以某种方式触发 UINavigationController 的布局.我可以使它正常工作的唯一方法是在 viewWillAppear:

                  It seems you need to somehow trigger the layouting for the UINavigationController. The only way I could make it work properly was by adding this in viewWillAppear:

                  - (void)viewWillAppear:(BOOL)animated {
                      [super viewWillAppear:animated];
                  
                      [self.navigationController setNavigationBarHidden:YES];
                      [self.navigationController setNavigationBarHidden:NO];
                  
                  }
                  

                  也许这个提示是为了在整个应用程序中一致地使用(意味着对所有视图控制器都有一个或没有一个),这就是为什么 UINavigationController 在更改时不会布局它的子视图.

                  Maybe this prompt is meant to be used consistently across the entire application (meaning having one for all viewControllers or none of them), that's why the UINavigationController does not layout it's subviews when it changes.

                  希望这对你也有用.

                  这篇关于以编程方式设置提示时,UINavigationBar 与 UITableView 重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  View being blocked by UITransitionView after being presented(呈现后被 UITransitionView 阻止的视图)

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

                  <legend id='xVLcY'><style id='xVLcY'><dir id='xVLcY'><q id='xVLcY'></q></dir></style></legend>
                      <tbody id='xVLcY'></tbody>

                            <bdo id='xVLcY'></bdo><ul id='xVLcY'></ul>

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