个人热点中断用户界面布局
问题描述:
当激活个人热点并将其自身调整为40px时,视图无法正确调整大小。底部在屏幕下方20px而不是调整大小。个人热点中断用户界面布局
我在所有视图控制器中都使用了自动布局,但即使我的应用程序用户界面像下面显示的图像一样突破。
任何帮助将是伟大的。
答
注册此通知在您的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
}
,你可以在这里找到一个很好的教程(SWIFT)http://studyswift.blogspot.in/2015/12/adjust-ui-components-programmatically.html
状态栏是高40个像素,而不是20时个人热点已开启。所以你应该调整约束 – AnshaD
是的你的权利,但这只是一个解决方法,我需要一个具体的解决方案。谢谢你的评论。 – Nilesh
请在下面检查我的答案 – AnshaD