在AppDelegate didFinishLaunchingWithOptions方法做处理
在AppDelegate.h里添加
@property (strong,nonatomic) MyViewController *viewController;
@property (strong,nonatomic) UINavigationController *naviController;
在AppDelegate.m里添加
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window =[[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];//建立窗口
self.viewControllerMy = [[MyViewController alloc]initWithStyle:UITableViewStyleGrouped];//初始化第一屏
self.naviController = [[UINavigationController alloc]initWithRootViewController:self.viewControllerMy];//把第一屏放入UINavigationController
self.window.rootViewController = self.naviController;//使UINavigationController赋予rootViewController
[self.window makeKeyAndVisible];//加载显示
return YES;
}
这样在加载其它UI 时使用[self.navigationController pushViewController:myViewController animated:YES];