ios - 个人热点打破 UI 布局

标签 ios ios-autolayout hotspot

当个人热点被激活并且 bar 将自身大小调整为 40 像素时, View 不会正确调整大小。底部在屏幕下方 20 像素处,而不是调整大小。

我在我的所有 View Controller 中都使用了自动布局,但即使我的应用程序 UI 中断,如下图所示。
enter image description here

任何帮助都会很棒。!

最佳答案

在您的 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/

相关文章:

ios - 将按钮连接到导航 View Controller

ios - 在热点全屏期间调整窗口大小时 AVPlayer 崩溃

ios - 将自定义单元格内的 View 居中

ios - 如果添加了新的 UITextField,如何向下移动许多 UITextField

iOS : getting crash while choosing that see pageviewcontroller for first time that apps loaded

swift - 使用 UIScrollView 和自动布局的图像 slider

ios - 如何使标签与屏幕尺寸成比例?

ios - Storyboard iOS - 如何将顶部边距作为屏幕尺寸的百分比而不是静态值顶部引脚边距?

c# - .NET UDP 客户端在互联网上的使用不起作用

linux - 从Linux上的wifi热点托管问题