iOS 非阻塞状态栏
iOS non blocking status bar
我正在尝试将图像放在状态栏后面。
我可以将它变成透明的,但它仍然阻止图像出现在它后面。
有人知道如何将状态栏从可编辑屏幕and/or 安全区域中分离出来吗?我不想删除它,只想把东西放在后面。
这是IB的样子
代码
override func viewWillAppear(_ animated: Bool) {
setNeedsStatusBarAppearanceUpdate()
}
override func viewDidLoad() {
super.viewDidLoad()
venueInfoTableView.dataSource = self
venueInfoTableView.delegate = self
// Do any additional setup after loading the view, typically from a nib.
venueInfoTableView.separatorStyle = .none
}
override var preferredStatusBarStyle : UIStatusBarStyle {
return UIStatusBarStyle.lightContent
//return UIStatusBarStyle.default // Make dark again
}
这是结果
你应该禁用 automaticallyAdjustsScrollViewInsets
if #available(iOS 11.0, *) {
self.venueInfoTableView.contentInsetAdjustmentBehavior = .never
} else {
self.automaticallyAdjustsScrollViewInsets = false
}
contentInsetAdjustmentBehavior
This property specifies how the safe
area insets are used to modify the content area of the scroll view.
The default value of this property is automatic.
我正在尝试将图像放在状态栏后面。
我可以将它变成透明的,但它仍然阻止图像出现在它后面。
有人知道如何将状态栏从可编辑屏幕and/or 安全区域中分离出来吗?我不想删除它,只想把东西放在后面。
这是IB的样子
代码
override func viewWillAppear(_ animated: Bool) {
setNeedsStatusBarAppearanceUpdate()
}
override func viewDidLoad() {
super.viewDidLoad()
venueInfoTableView.dataSource = self
venueInfoTableView.delegate = self
// Do any additional setup after loading the view, typically from a nib.
venueInfoTableView.separatorStyle = .none
}
override var preferredStatusBarStyle : UIStatusBarStyle {
return UIStatusBarStyle.lightContent
//return UIStatusBarStyle.default // Make dark again
}
这是结果
你应该禁用 automaticallyAdjustsScrollViewInsets
if #available(iOS 11.0, *) {
self.venueInfoTableView.contentInsetAdjustmentBehavior = .never
} else {
self.automaticallyAdjustsScrollViewInsets = false
}
contentInsetAdjustmentBehavior
This property specifies how the safe area insets are used to modify the content area of the scroll view. The default value of this property is automatic.