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

查看:33
本文介绍了如何让我的 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 并将 Show Navigation Bar 设置为 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. 向新的 UIViewController 添加一个 TableView(不是控制器),根据需要放置,它会吸附到状态栏的底部
  4. 将TableView的delegatetableSource设置为新的控制器
  5. 创建自定义 UIViewController 子类并更新 storyboard 中控制器的类类型
  6. 将与表格相关的方法从我的自定义 UITableViewController 子类复制到我的新子类<​​/li>
  7. 从原始表格中选择我的原型表格单元格,然后命令+将其拖动到新表格视图
  8. 很高兴删除原始的 TableViewController(和包装器 NavigationController)
  9. 更新标签栏项目以匹配上一个
  10. 因为你很努力"而另起炉灶
  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天全站免登陆