swift - 使用 Xcode 11.3 在 iOS 13 上未显示栏
问题描述
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
}
推荐阅读
- css - 角度全局样式中的边距未强制执行
- python - 如何从列表中删除具有三个重复字母的单词?
- javascript - 从formData获取所有文件
- arrays - 如何在 SwiftUI 中使用本地化字符串对数组进行排序
- python - Python:排序列表时如何停止while循环?
- sql - SQL 中是否有一种方法可以强制执行无向边的唯一性?
- python - 使用 pyspark udf 时出现导入错误
- vue.js - Nativescript vue:动态设置图像 src.decode 以显示字体图标
- javascript - 表格提交成功
- azure - Azure 存储:使用具有创建权限的 SAS 时 AuthorizationPermissionMismatch