本文介绍了个人热点破坏了UI布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
激活个人热点并将栏自身调整为40px时,视图将无法正确调整大小.底部位于屏幕下方20px,而不是调整大小.
When the personal Hotspot is activated and bar resizes itself to 40px, the view does not resize correctly. The bottom goes 20px below the screen instead of being resized.
我在所有View Controller中都使用了自动布局",即使我的应用程序UI中断,如下图所示.
I am using Auto Layout in all my View Controllers but even though my app UI breaks like the image shows below.
任何帮助都会很棒.
推荐答案
在您的viewdidload中注册此通知
Register this notification in your 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
you can find a nice tutorial here (in swift) http://studyswift.blogspot.in/2015/12/adjust-ui-components-programmatically.html
这篇关于个人热点破坏了UI布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!