iOS-导航控制器什么情况会给push出来的控制器View自动加
作者:
船长_ | 来源:发表于
2015-12-06 01:04 被阅读2867次
- 结论:在 iOS 7 中,如果某个 UIViewController 的 self.view 第一个子视图是 UIScollView或者是继承与UIScollView, 同时当这个 UIViewController 被 push 或 initWithRootController 成为 UINavigationController控制的Controller时,这个 UIViewController的 view 的子视图 UIScollView 的所有子视图, 都会被下移 64px;
- 注意: 这个下移 64px 的前提是 navigationBar 和 statusBar 没有隐藏。因为为 statusBar 默认的 Height 是 20px,而 navigatiBar 默认的 Height 是 44px
验证1: UIViewController的第一个视图是UITableView,第二个视图是普通的UIView;如图

Snip20151206_1.png
结果如图:有自动添加64高度

Snip20151206_3.png
验证2: UIViewController的第一个视图不是UITableView,第二个视图是普通的UIView;如图

Snip20151206_2.png
结果如图:没有自动添加64高度

Snip20151206_5.png
本文标题:iOS-导航控制器什么情况会给push出来的控制器View自动加
本文链接:https://www.haomeiwen.com/subject/gvzshttx.html
网友评论