UIWindow不使用代理如何实现根控制器的跳转(页面跳转的实现)

时间:2023-01-01 20:39:40

1.单独跳转页页面

#pragma mark - changeViewController控制器跳转

- (void)changeViewController{

    LoginPageController * login = [[LoginPageController alloc]init];

    UIWindow * window = [UIApplication sharedApplication].keyWindow;

    window.rootViewController = login;

}

@end

2.跳转的页面有导航栏(UINavigationController)和UITabBarController

#pragma mark - viewController跳转

- (void)changeViewController{

   

    DetailPageController * detailPage = [[DetailPageController alloc]init];

     UINavigationController * nv = [[UINavigationController alloc]initWithRootViewController:detailPage];

    UITabBarController * tab = [[UITabBarController alloc]init];

    tab.viewControllers = @[nv];// 将导航栏加入tabbar控制器

   UIWindow * window = [UIApplication sharedApplication].keyWindow;

    window.rootViewController = tab;

}




UIWindow不使用代理如何实现根控制器的跳转(页面跳转的实现)UIWindow不使用代理如何实现根控制器的跳转(页面跳转的实现)UIWindow不使用代理如何实现根控制器的跳转(页面跳转的实现)UIWindow不使用代理如何实现根控制器的跳转(页面跳转的实现)