1. edgesForExtendedLayout
@available(iOS 7.0, *)
open var edgesForExtendedLayout: UIRectEdge
控制Controller的view是否扩展到半透明的bar(NavigationBar, UITabBar)所在的区域
// top, left, bottom, right, all
edgesForExtendedLayout = [] // 四个方向都不伸展
@available(iOS 7.0, *)
public struct UIRectEdge : OptionSet {
public init(rawValue: UInt)
public static var top: UIRectEdge { get }
public static var left: UIRectEdge { get }
public static var bottom: UIRectEdge { get }
public static var right: UIRectEdge { get }
public static var all: UIRectEdge { get }
}
2. automaticallyAdjustsScrollViewInsets
@available(iOS, introduced: 7.0, deprecated: 11.0, message: "Use UIScrollView's contentInsetAdjustmentBehavior instead")
open var automaticallyAdjustsScrollViewInsets: Bool // Defaults to YES
值为YES的时候自动调整UIScrollView的contentInset值来保证内容不被bar(NavigationBar, UITabBar)遮挡,iOS11中用contentInsetAdjustmentBehavior替代该属性。
if #available(iOS 11, *) {
wkWebView?.scrollView.contentInsetAdjustmentBehavior = .never // 不自动调整 ContentInset
} else {
automaticallyAdjustsScrollViewInsets = false // 不自动调整 ContentInset
}
3. contentInset
ScrollView的边距控制属性
网友评论