TableView滚动下方的顶部栏 [英] TableView scroll underlying top bar

查看:158
本文介绍了TableView滚动下方的顶部栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我将我的应用更新到iOS 7新GUI后,我遇到了一个无法解决的问题。

Since I updated my app to iOS 7 new GUI I have a problem that I can't solve.

我的应用程序包含一个可滚动的TableView。麻烦的是TableView滚动下面的顶部栏,意味着表不考虑顶部栏并延伸到顶部并且看起来很难看。

My app consists in a scrollable TableView. Trouble is that TableView scrolls underlying top bar, means that table doesn't consider top bar and extends till the top and it's ugly to see.

我尝试删除在顶栏下延伸边缘的检查,但它是一样的。

I tried removing check on "Extend edges under Top Bars" but it's the same.

我该如何解决这个问题?

How can I solve this?

推荐答案

一个解决方案是:设置表格视图的 contentInset scrollIndicatorInsets 顶部插入为20.表格视图仍会显示状态栏,但在完全滚动时它将完全可见。

One solution is: set the table view's contentInset and scrollIndicatorInsets to have a top inset of 20. The table view will still underlap the status bar, but it will be completely visible when scrolled all the way.

如果你不喜欢这个解决方案,并且你想在状态栏后面留一个永久的空白区域,你将不得不改变你固定/定位表格顶部的方式,以允许状态栏。如何执行此操作取决于您是否使用自动布局。如果你是,只需固定顶部布局指南。如果不是,则必须使用nib编辑器中提供的delta字段。

If you don't like that solution, and you want a permanent empty area behind the status bar, you will have to change the way you pin/position the top of the table view, to allow for the status bar. How you do this depends on whether you are using auto layout. If you are, just pin to the top layout guide. If you are not, you will have to use the "delta" field provided in the nib editor.

但是,如果您使用的是UITableViewController,则不需要表格顶部的视图;它是一个全屏视图,它是视图控制器的主视图。实际上,这是一个非常麻烦的情况。我已经采用了两种解决方案:

If you are using a UITableViewController, however, you are not in charge of the top of the table view; it is a full-screen view and it is the view controller's main view. This is quite a troublesome situation, actually. I have resorted to two solutions:


  • 将整个事物放入UINavigationController中以使导航栏运行干扰 对我来说。

  • Put the whole thing into a UINavigationController in order to get the nav bar to "run interference" for me.

或者,将表视图控制器嵌入到自定义父视图控制器中,以便我可以定位表视图的顶部。

Or, embed the table view controller in a custom parent view controller just so that I can position the top of the table view.

这篇关于TableView滚动下方的顶部栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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