[英]Why black screen display between navigationBar and view
在我的项目中,将两个View Controller(First和Second)嵌入到导航控制器中,并将Translucent设置为NO。 但是我已经在First ViewController中使用了提示。
我使用了自动版式。 如果您知道使用和不使用AutoLayout的解决方案,我都会非常高兴
当我推到第二个viewcontroller。 我在导航栏下看到一些黑屏
我尝试了很多概念,但没有任何帮助。
帮我如何解决。
注意:
不要说将“半透明”设置为“是”。 我知道我是否设置为完美。 但是我需要用半透明实现
更新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);
}
我希望这会有所帮助,对于自动版式它也能正常工作
我用了这段代码。 但我不会提供任何硬编码解决方案。 如果您知道其他解决方案,请分享
[UIView animateWithDuration:0.3 animations:^{
self.view.frame=CGRectMake(0, self.navigationController.navigationBar.frame.size.height+20, 320, 504);
}];
尝试设置您的navigationView的backgroundColor
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.