在我的项目中,有两个 View Controller (第一和第二)嵌入在导航 Controller 中,半透明设置为否。但我在第一个 ViewController 中使用了提示。
我使用了自动布局。如果您知道使用和不使用 AutoLayout 的解决方案,我会非常高兴
当我推送到第二个 View Controller 时。我的导航栏下出现一些黑屏
我尝试了很多概念,但有帮助。
帮我解决一下。
注意:
不要说 set Translucent 为 YES。我知道如果我设置"is"它就可以完美工作。但我需要半透明的实现是不
更新1:图像已更新。
最佳答案
我已经关闭了自动布局 - 并找到了以下解决方案
ViewController优先
-(void)viewWillDisappear:(BOOL)animated
{
self.view.backgroundColor = [UIColor whiteColor];
}
ViewController 第二
-(void)viewWillLayoutSubviews
{
AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
appDelegate.window.backgroundColor = [UIColor whiteColor];
self.myView.frame = CGRectMake(0.0, 64.0, 320.0, 504.0);
}
我希望这有帮助,对于自动布局它也工作得很好
关于ios - 为什么navigationBar和view之间显示黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21695495/