iOS设置初始页面
一些改变
在iOS13以前设置初始页面需要在AppDelegate里实现,但是在iOS13以后设置初始页面需要在SceneDelegate。
设置初始页面(ViewController)
Swift
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window?.frame = windowScene.coordinateSpace.bounds
let tabBarController = UITabBarController()
let navigationController = UINavigationController(rootViewController: tabBarController);
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}
OC
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISc