【发布时间】:2018-09-07 19:12:12
【问题描述】:
在我切换通话状态栏后,导航栏消失。而后面的内容高度为 20 。
我不知道为什么。
图为现场。
看起来导航栏掉了。蓝条掉下来。
从视图层级调试器看,不知道为什么蓝条和导航栏有距离。
这里是相关代码。
- (void)viewWillLayoutSubviews{
self.blueBar.translatesAutoresizingMaskIntoConstraints = NO;
[super viewWillLayoutSubviews];
[self.blueBar.topAnchor constraintEqualToAnchor: self.view.topAnchor].active = YES;
[self.blueBar.leadingAnchor constraintEqualToAnchor: self.view.leadingAnchor].active = YES;
[self.blueBar.trailingAnchor constraintEqualToAnchor: self.view.trailingAnchor].active = YES;
[self.blueBar.heightAnchor constraintEqualToConstant: 75].active = YES;
......
}
-(UIView *)blueBar{
if(!_blueBar){
_blueBar = [[UIView alloc] init];
_blueBar.backgroundColor = [UIColor blueColor];
}
return _blueBar;
}
【问题讨论】:
标签: ios objective-c uiview