iOS 程序初始一个带导航栏的视图

时间:2023-03-09 06:11:45
iOS  程序初始一个带导航栏的视图
@synthesize window = _window;
@synthesize rootViewController = _rootViewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; _rootViewController = [[ViewController alloc] init]; UINavigationController *rootNaviController = [[UINavigationController alloc] initWithRootViewController:_rootViewController]; self.window.rootViewController = rootNaviController;
[self.window makeKeyAndVisible]; return YES;
}

在上述情况下的跳转:

UINavigationController *nav = (UINavigationController*)self.window.rootViewController;
[nav pushViewController:controller animated:YES];