UINavigationController詳解(一)

來源:互聯網
上載者:User

標籤:style   blog   http   color   使用   2014   


@UINavigationControlle簡介:

1.導航控制器,專門管理控制器的控制器.

2.採用棧的方式管理所有controller,每個controller管理各自的視圖

@UINavigationControlle結構:

1.它是UIViewController的子類,因此它也由view屬性

2.它的view包含3個子視圖:navigationBar     contentView(不是屬性)      toolbar

3.導航控制器使用這些對象實現導航介面,我們負責提供這些對象,進行展示,參考(蘋果官方):


@UINavigationControlle的建立:

1.它以棧的方式管理所控制的視圖,至少要有一個被管理的UIViewController作為rootViewController

2.導航介面的對象會被同時建立

3.設定delegate,監控導航堆棧的變化,即viewControllers,topController,visibleController等等



@UINavigationControlle導航方法:

1.推出下一級controller(入棧):

    pushViewController:animated:

2.返回上一級controller(出棧):

    popViewControllerAnimated:                         // 返回上一級 

    popToRootViewControllerAnimated:              // 返回根視圖(中間無論多少個視圖都全部被出棧,沒了)

    // @property(nonatomic,copy)NSArray *viewControllers;// The current view controller stack.

    // 通過[self.navigationController.viewControllers objectAtIndex:n] 來選定指定視圖

    popToViewController:animated:                     //  返回指定視圖

3.導航控制器提供已有的控制項實現返回上一級(即被根視圖推出的View都內建一個返回 <Back 按鈕)

程式碼範例:

@這裡必須要說一下self.navigationController  

// If this view controller has been pushed onto a navigation controller, return it.




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.