ios - 为什么navigationBar和view之间显示黑屏

标签 ios iphone objective-c uinavigationbar translucency

在我的项目中,有两个 View Controller (第一和第二)嵌入在导航 Controller 中,半透明设置为否。但我在第一个 ViewController 中使用了提示。

我使用了自动布局。如果您知道使用和不使用 AutoLayout 的解决方案,我会非常高兴

enter image description here

enter image description here

当我推送到第二个 View Controller 时。我的导航栏下出现一些黑屏

enter image description here

我尝试了很多概念,但有帮助。

帮我解决一下。

注意:

不要说 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/

相关文章:

android - 如何让我的智能家居应用在 Google Home 应用中显示为建议

objective-c - 具有 iPad 视网膜显示屏的模拟器

ios - 如何确定是否正在等待调度信号量?

ios - 如何使用 NSRegularExpression 提取字符串的特定部分?

IOS - 标签栏项目图像修改

iphone - WebKitErrorDomain 错误 101

iphone - 迭代 NSString 数组并比较它们的更有效方法

ios - 如何查找 iOS 应用程序的电池使用情况

ios - 当我滚动 UITableViewCell 时,在 iOS 中选择的图像发生变化之前

iphone - UIViewControllerHierarchyInconsistency 异常时