gpt4 book ai didi

iOS:当 View 位于弹出框后面时,我如何注意到?

转载 作者:行者123 更新时间:2023-12-01 19:59:56 24 4
gpt4 key购买 nike

在我的应用程序中,我显示了一个弹出框,这会导致弹出框后面的所有着色 UIImageViews 去饱和。我希望这种行为也适用于屏幕上的 UILabel 和自定义 UIView 子类。为此,我需要观察弹出框何时打开以及何时关闭,以便手动更新颜色。

我的第一种方法是观察 UIView 的 tintColortintAdjustmentMode特性。像这样:

override var tintAdjustmentMode: UIViewTintAdjustmentMode {
didSet {
// This does not get called
}
}

然而,这些似乎没有被调用,即使 self.tintAdjustmentMode等于 true当我在显示弹出窗口时手动检查时。

另一种方法是从显示弹出框的 ViewController 中手动调用辅助方法(在本例中为 CollectionViewController)。问题在于,当另一个 ViewController(比如封闭的导航 Controller )呈现弹出框时,这不起作用。所以这也不是我真正想要的。

还有哪些其他方法可以让我对 View 的当前 View Controller 上显示的弹出框使用react?

最佳答案

要回答我自己的问题,有一个 UIView 方法 tintColorDidChange覆盖。

override func tintColorDidChange() {
// This gets called
}

苹果引用: https://developer.apple.com/reference/uikit/uiview/1622620-tintcolordidchange

关于iOS:当 View 位于弹出框后面时,我如何注意到?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40285491/

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