如何让我的iOS7 UITableViewController不显示在顶部状态栏下? [英] How do I make my iOS7 UITableViewController NOT appear under the top status bar?

查看:149
本文介绍了如何让我的iOS7 UITableViewController不显示在顶部状态栏下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的根控制器是一个TabBarController(选项卡式应用程序)。其中一个选项卡是UITableViewController。当我切换到那个并滚动项目时,它们会显示在顶部的状态栏下(信号,电池等)。我不希望这样。我希望那是不透明的......或某种东西。它在视觉上会震动,表格单元格的文本会显示状态。

My root controller is a TabBarController (tabbed application). One of the tabs, is a UITableViewController. When I switch to that and scroll through the items, they show up under the status bar at the top (signal, battery, etc). I don't want that. I want that to be opaque or... something. It's visually jarring with the text of the table cells underlapping the status stuff.

我可以通过我的故事板修复此问题,并设置一些我不理解的属性吗?或者我需要在子类中添加一些方法吗?或者我可能需要用其他类型的控制器包装我的UITableViewController?

Can I fix this from my Storyboard with some attributes setting that I don't understand? Or do I need to add some methods to my subclasses? Or maybe I need to wrap my UITableViewController with some other kind of controller?

我在Storyboard属性页面中尝试了多种ViewController Layout和Extend Edges设置的变体,但是他们似乎都没有改变它。

I've tried numerous variations of the ViewController Layout and Extend Edges settings in the Storyboard attributes page, but none of them seem to change it for the better.

更新:我认为我的问题非常类似于 iOS 7:UITableView显示在状态栏下。唯一的区别是,我嵌入了一个TabBarController,那个案例就是根视图。我尝试了在 NavigationController 中嵌入的解决方案,并将显示导航栏设置为 False ,但没有任何区别。

Update: I think my problem is very similar to iOS 7: UITableView shows under status bar. The only difference, is that I'm embedded in a TabBarController, and that case is as the root view. I tried the solution listed there of embedding in a NavigationController and setting Show Navigation Bar to False, but it didn't make any difference.

屏幕截图

我的故事板(收缩)显示一个标签式控制器,有2个孩子,一个单一视图,另一个是表视图。

My storyboard (shrunk) showing a tabbed controller, with 2 children, one single view, and the other the table view.

标签栏控制器的设置

表格视图控制器的设置

应用程序最终看起来就像在我的手机上一样

What the app ends up looking like on my phone

故事的结局

尽管下面有很多答案,但它们都没有真正起作用。某种程度的,但不是真的。我也尝试了 Embed in NavigationController 方法,这也有问题。但是有什么用呢:

Despite lots of answers below, none of them really worked. Some kind of a little, but not really. I tried the Embed in NavigationController approach as well, and that also had issues. What did work though, was this:


  1. 添加UIViewController

  2. 设置子控制器与它的关系标签栏控制器(就像我已经拥有的其他两个一样)

  3. 将一个TableView(非控制器)添加到新的UIViewController,根据需要定位,它将捕捉到状态的底部bar

  4. 将TableView的委托 tableSource 设置为新控制器

  5. 创建自定义UIViewController子类并更新故事板中控制器的类类型

  6. 将表格相关方法从我的自定义UITableViewController子类复制到我的新子类

  7. 从原始表中选择我的原型表格单元格,然后命令+将其拖动到新表格视图

  8. 高兴地删除原来的TableViewController(和包装器NavigationController)也是

  9. 更新标签栏项目以匹配前一个

  10. Chock另一个f up或者你正在努力

  1. Add UIViewController
  2. Set child controller relationship with it and tab bar controller (just like the other two I already had)
  3. Add a TableView (not controller) to the new UIViewController, position as desired, it'll snap to the bottom of the status bar
  4. Set the TableView's delegate and tableSource as the new controller
  5. Create a custom UIViewController subclass and update the class type of the controller in the storyboard
  6. Copy the table related methods from my custom UITableViewController subclass to my new subclass
  7. Select my prototype table cell from the original, and command+drag it to the new table view
  8. Happily delete the original TableViewController (and wrapper NavigationController) too
  9. Update the tab bar item to match the previous
  10. Chock another one up for "you're trying to hard"


推荐答案

如果有人错过故事如何结束部分(现在很长)的问题,简短的回答是:使用带有TableView的简单UIViewController ,而不是TableViewController,如果你想实现既定目标。

In case anyone misses the How the story ended section at the end of the (now long) question, the short answer is: Use a simple UIViewController with a TableView, instead of a TableViewController if you want to achieve the stated goal.

这篇关于如何让我的iOS7 UITableViewController不显示在顶部状态栏下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆