使用 Xcode 11.3 在 iOS 13 上未显示柱状图
Bars not showing on iOS 13 using Xcode 11.3
UITabBar
未在 iOS 13.2
上显示
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
window = UIWindow(frame: UIScreen.main.bounds)
let rootViewController = UITabBarController()
rootViewController.viewControllers = [RecordController()]
window?.rootViewController = rootViewController
window?.makeKeyAndVisible()
return true
}
}
和 UINavigationBar
未在 iOS 13.2
上显示
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = UINavigationController(rootViewController: RecordController())
window?.makeKeyAndVisible()
return true
}
}
这对 iOS 12 岁及以上
非常有效
如果您使用 13.2,则需要替换 Scene Delegate 中的代码。如果您的 xcode 中没有场景委托,则在 didFinishLaunchingWithOptions 委托中使用此条件。
希望它对你有用。
谢谢
if #available(iOS 13, *) {
return //code for ios 13
} else {
return // code for ios 12 or lower version
}
UITabBar
未在 iOS 13.2
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
window = UIWindow(frame: UIScreen.main.bounds)
let rootViewController = UITabBarController()
rootViewController.viewControllers = [RecordController()]
window?.rootViewController = rootViewController
window?.makeKeyAndVisible()
return true
}
}
和 UINavigationBar
未在 iOS 13.2
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = UINavigationController(rootViewController: RecordController())
window?.makeKeyAndVisible()
return true
}
}
这对 iOS 12 岁及以上
非常有效如果您使用 13.2,则需要替换 Scene Delegate 中的代码。如果您的 xcode 中没有场景委托,则在 didFinishLaunchingWithOptions 委托中使用此条件。
希望它对你有用。 谢谢
if #available(iOS 13, *) {
return //code for ios 13
} else {
return // code for ios 12 or lower version
}