標籤:
1 模態(model)
//進入B頁面(在A頁面寫以下代碼)
(1) B頁面名 *VC=[[B頁面名 alloc] init];
VC.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
或(2) B頁面名 *VC=[[B頁面名 alloc] initWithNibName:@"B頁面名" bundle: nil];
[self presentModalViewController:zhuchu animated:YES];//顯示模態畫面
//返回A頁面(在B頁面寫以下代碼)
[self dismissModalViewControllerAnimated:YES];//關閉模態畫面
2 SwitchViewController (同時啟動兩個畫面)
self.view insertSubview:(載入的新頁面) atIndex:n;
提示:n表示載入到那一層上面
多用於在一個頁面中有時要顯示或隱藏某個View會遮擋
3 UITabBarController(實現並列畫面跳轉)
self.tabBarController.viewControllers = @[navFrist, navSecond,navThird,navFourth,navFifth];
self.window.rootViewController = self.tabBarController;
[self.window addSubview:self.tabBarController.view];//將根控制器的視圖加到應用程式主視窗
4 UINavigationController(實現多層畫面跳轉),在導航控制器中,載入有層級關係的介面
//進入B頁面(在A頁面寫以下代碼)
B頁面名 *addSymbol=[[B頁面名 alloc] initWithNibName:@"B頁面名" bundle: nil];
[self.navigationController pushViewController:addSymbol animated:YES];
//返回A頁面(在B頁面寫以下代碼)
[self.navigationController popViewControllerAnimated:YES]; //彈出後返回到原視圖
IOS學習-頁面切換方式