当个人热点被激活并且 bar 将自身大小调整为 40 像素时, View 不会正确调整大小。底部在屏幕下方 20 像素处,而不是调整大小。
我在我的所有 View Controller 中都使用了自动布局,但即使我的应用程序 UI 中断,如下图所示。
任何帮助都会很棒。!
最佳答案
在您的 viewdidload 中注册此通知
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(statusBarFrameWillChange:)name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
}
- (void)statusBarFrameWillChange:(NSNotification*)notification
{
NSLog(@"STATUS BAR UPDATED");
int statusHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
NSLog(@"status bar height %d", statusHeight);
// Here you can do your constraint adjustments accordingly
}
你可以在这里找到一个很好的教程(快速)http://studyswift.blogspot.in/2015/12/adjust-ui-components-programmatically.html
关于ios - 个人热点打破 UI 布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44537654/