我有一个UINavigationController
,可以将数据显示为UICollectionView
或UITableView
。 iOS 7自动为在 View 层次结构中建立的第一个UIScrollView
调整滚动 View 插图。
因此,UICollectionView
可以,但是我必须为contentEdgeInset
设置UITableView
。在这行之后self.tableView.contentInset = UIEdgeInsetsMake(44.0f, 0.0f, 0.0f, 0.0f);
UITableView
中的内容显示得很好,但是滚动指示器不会在UINavigationBar
处停止,而是在其下继续。
如何解决此问题并在UINavigationBar
的开头停止滚动指示器?
最佳答案
您还可以如下设置scrollIndicatorInsets
:
self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(44.0f, 0.0f, 0.0f, 0.0f);
顺便说一句,在iOS 7上,您应该使用
[self.topLayoutGuide length]
而不是对44.0f
像素进行硬编码。从iOS 7 Transition Guide:关于ios - 修改contentEdgeInset之后,UINavigationBar下的UITableView滚动指示器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22812172/