码迷,mamicode.com
首页 > 其他好文 > 详细

让控制器的view顶到屏幕最上方,也就是状态栏底下

时间:2016-06-24 20:30:47      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

这句代码可以吧view顶到状态栏里面 贴在屏幕最上方

技术分享
这句代码还会吧view顶到最下方,所以如果项目中是用tabBarController开发的时候

tableview下方总显示不完全,用代码设置偏移量也没用;

官方文档解释如下:
 
 
A Boolean value that indicates whether the view controller should automatically adjust its scroll view insets.
 
Declaration
SWIFT
var automaticallyAdjustsScrollViewInsets: Bool
OBJECTIVE-C
@property(nonatomic, assign) BOOL automaticallyAdjustsScrollViewInsets
Discussion
The default value of this property is YES, which allows the view controller to adjust its scroll view insets in response to the screen areas consumed by the status bar, navigation bar, and toolbar or tab bar. Set to NO if you want to manage scroll view inset adjustments yourself, such as when there is more than one scroll view in the view hierarchy.
 
Availability
Available in iOS 7.0 and later.
简单点说就是automaticallyAdjustsScrollViewInsets根据按所在界面的status bar,navigationbar,与tabbar的高度,自动调整scrollview的 inset,设置为no,不让viewController调整,

所以为了避免出现的问题 可以自己手动设置contentInset 也能达到一样的效果;

技术分享

让控制器的view顶到屏幕最上方,也就是状态栏底下

标签:

原文地址:http://www.cnblogs.com/chroad/p/5615225.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!