【发布时间】:2025-12-23 08:25:12
【问题描述】:
我遇到了如下问题,找了好几个地方,都没有找到解决办法,因为我在AppDelegate中的didFinishLaunchingWithOptions中添加了几行代码,来确定在哪个ViewController会启动开始并使用在关闭应用程序之前保存的数据加载数组,旋转设备时,在模拟器或我的 iPhone 中,旋转时不会生成动画。
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func preferredStatusBarStyle() -> UIStatusBarStyle {
return UIStatusBarStyle.lightContent
}
UINavigationBar.appearance().barTintColor = UIColor(red: 252/255.0, green: 140.0/255.0, blue: 90.0/255.0, alpha: 1)
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white]
UIToolbar.appearance().barTintColor = UIColor(red: 252/255.0, green: 140.0/255.0, blue: 90.0/255.0, alpha: 1)
UIBarButtonItem.appearance().tintColor = UIColor.white
self.window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard (name: "Main", bundle: nil)
...
}
这里是 GIF:
【问题讨论】:
标签: ios swift animation screen-rotation