在我的项目中,将两个视图控制器(第一和第二个)嵌入导航控制器中,并将半透明设置为NO。但我在First ViewController中使用了提示。
我使用了AutoLayout。如果您知道使用和不使用AutoLayout的解决方案,我会非常高兴
当我推到第二个viewcontroller。我在导航栏下面有一些黑屏
我尝试了很多概念,但任何帮助。
帮我解决。
注意:
不要说设置半透明是YES。我知道如果我设置它是完美的。但我需要用Translucent实现NO
更新1:图像已更新。
答案 0 :(得分:4)
我关闭了Autolayout - 并找到了以下解决方案
ViewController First
-(void)viewWillDisappear:(BOOL)animated
{
self.view.backgroundColor = [UIColor whiteColor];
}
ViewController Second
-(void)viewWillLayoutSubviews
{
AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
appDelegate.window.backgroundColor = [UIColor whiteColor];
self.myView.frame = CGRectMake(0.0, 64.0, 320.0, 504.0);
}
我希望这有帮助,对于Autolayout它也可以正常工作
答案 1 :(得分:0)
[UIView animateWithDuration:0.3 animations:^{
self.view.frame=CGRectMake(0, self.navigationController.navigationBar.frame.size.height+20, 320, 504);
}];
答案 2 :(得分:-1)
尝试设置navigationView的backgroundColor
。