IOS页面切换方式

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]; //弹出后返回到原视图

posted @ 2014-07-03 11:39  洛妤  阅读(296)  评论(0编辑  收藏  举报