IOS開發 頁面跳轉

三種方式

IndexController *VC =[ [IndexController alloc] init];

1.

[[[UIApplication sharedApplication] delegate] window].rootViewController = VC;

2.

[self presentViewController:VC animated:YES completion:nil];

3.

[self.navigationController pushViewController:VC animated:YES];

註釋:第三種方法 要在AppDelegate設置 根控制器

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

ViewController *rootVC = [[ViewController alloc] init];

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootVC];

self.window.rootViewController = nav;

[self.window makeKeyAndVisible];

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章