码迷,mamicode.com
首页 > 移动开发 > 详细

iOS UIViewController 的automaticallyAdjustsScrollViewInsets属性

时间:2016-03-04 16:21:52      阅读:304      评论:0      收藏:0      [点我收藏+]

标签:

在iOS7.0以后,UIViewController添加了automaticallyAdjustsScrollViewInsets,关于此属性的描述看官方文档解释


automaticallyAdjustsScrollViewInsets
 Property
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.

当我们在VC视图中添加一个UIScrollView,设置起frame为(0,0,320,568),在UIScrollview上添加子视图A,设置A的坐标为(0,0,100,17),但实际显示得到的效果,看起来是A的坐标为(0,64,100,17)。此时只要设置automaticallyAdjustsScrollViewInsets为NO,就可以得到正确的坐标效果。

 

automaticallyAdjustsScrollViewInsets 属性默认会给scrollview自动适应屏幕

 

iOS UIViewController 的automaticallyAdjustsScrollViewInsets属性

标签:

原文地址:http://www.cnblogs.com/yinyanlyy/p/5242310.html

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