gpt4 book ai didi

ios - 将当前 UIViewController 内置动画与其他动画同步

转载 作者:行者123 更新时间:2023-11-30 11:12:08 24 4
gpt4 key购买 nike

有没有办法将内置的 UIViewController 动画与其他动画同步?

我使用 present(_:animated:completion:) 展示我的 UIViewController

在新的 UIViewController 上,我更改状态栏背景颜色,如下所示:

UIApplication.shared.statusBarView?.backgroundColor = UIColor.red

(我已经扩展了 UIApplication 类,因此我有一个属性 statusBarView ,它返回 UIApplication.shared.value(forKey: "statusBar") 作为? UIView)

我还将状态栏从 .default 更改为 .lightContent

有没有办法将内置的UIViewController当前动画与状态栏上的动画同步(更改为.lightContentbackgroundColor ),或者我是否必须构建自定义过渡动画?

最佳答案

是的,您可以使用简单的 UIAnimation,

UIView.animate(duration: 0.6, animate: {//You can do whatever you want with the presented view }, completion: {//present the desired view controller})

关于ios - 将当前 UIViewController 内置动画与其他动画同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52073730/

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