检测何时弹出呼叫,麦克风或位置横幅 - iOS Swift

时间:2017-03-08 01:49:04

标签: ios swift3

是否有一个聆听功能可让您在顶部弹出横幅时调整视图的布局? (即表示"触摸返回电话","录制","地图使用您的位置"等等的横幅)

1 个答案:

答案 0 :(得分:0)

应该调用您的viewWillLayoutSubviews()方法。您可以根据视图边界相应地覆盖和调整视图。更多信息在这里

https://developer.apple.com/reference/uikit/uiviewcontroller/1621437-viewwilllayoutsubviews

Swift代码:

override func viewWillLayoutSubviews() {
        super.viewWillLayoutSubviews()
        // Use self.view.bounds to do what you want to

    }

目标C代码:

- (void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];

    // use self.view.bounds to do what you want to
}