gpt4 book ai didi

ios - 在容器 View ( Storyboard)中推送透明背景 UIViewController 时的灰色背景

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:01:06 26 4
gpt4 key购买 nike

我正在将 UIViewController (A) 与 clearColor 作为 UINavigationController 的背景(>N).

N 被放置在容器 View 中。这个 View 有一个我想一直显示的背景。

Container-UINavigation-Push

然后,当 Push 动画化时,它会在我的 VC (A) 中显示灰色/透明背景,当它完成动画时,它会正确显示。

有什么办法可以避免这种灰色?

我通过在 A 中放置一个白色 View 背景并使其在 viewDidAppear 中消失来“完成”它,但我认为它可以在没有那个技巧的情况下完成......

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
__weak TestsViewController *weakSelf = self;
[UIView animateWithDuration:.3 animations:^{
TestsViewController *ownSelf = weakSelf;
ownSelf.backgroundView.alpha = 0;
}];
}

最佳答案

将应用窗口的背景颜色设置为白色:

// applicationDidFinishLaunching
self.window.backgroundColor = [UIColor whiteColor];

推送动画往往使用透明区域后面窗口的背景色结束,窗口背景色默认是透明的,所以通过透明的导航栏和工具栏显示黑色。

编辑:抱歉,我误解了问题所在。当您按下具有透明背景色的 View Controller 时,您在 View Controller 后面看到的背景是渲染在 View Controller 后面的阴影(在非透明 View Controller 中,您可以看到它的边缘)。

This question有你的问题的答案。基本上,您必须实现自定义动画 Controller ,以自己提供过渡动画(如 here 所述)。继续使用您的技巧可能比实现您自己的自定义导航转换更容易。

关于ios - 在容器 View ( Storyboard)中推送透明背景 UIViewController 时的灰色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30348499/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com