IOS學習-頁面切換方式

來源:互聯網
上載者:User

標籤:

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學習-頁面切換方式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.