iOS UIViewController的種類和作用
Controller的9大種類
- View Controller - Provides view-management functionality for toolbars, navigation bars, and application views. The UIViewController class also supports modal views and rotating views when device orientation changes.
- Navigation Controller - Manages a stack of view controllers, each of which represents information about a view, such as its title and the navigation item associated with the view. When view controllers are pushed onto and popped off the stack, the navigation controller updates the navigation bar and view appropriately.
- Table View Controller - Manages a UITableView, automatically creating an instance with the correct dimensions and resizing mask, and acting as the table view's delegate and data source. The UITableViewController class also provides toggling of editing modes.
- Collection View Controller - Manages a UICollectionView, automatically creating an instance with the correct dimensions and resizing mask, and acting as the collection view's delegate and data source.
- Tab Bar Controller - Manages a set of view controllers, each of which represents a tab bar item. Each view controller provides information about its tab bar item and supplies the view to be displayed when the item is selected.
- Split View Controller - A composite view controller that manages left and right view controllers.
- Page View Controller - Presents a sequence of view controllers as pages, via coordination with a data source and delegate. Swipe navigation between the pages is automatically handled with a page curl transition that tracks the user's finger. The navigation orientation can be horizontal, like pages in a book, or vertical, like pages in a wall calendar.
- GLKit View Controller - The GLKViewController class provides all of the standard view controller functionality, but additionally implements an OpenGL ES rendering loop. A GLKViewController object works in conjunction with a GLKView object to display frames of animation in the view.
- AVKit Player View Controller - A controller that manages an AVPlayer object, which can display audiovisual content and standard playback controls.
- Search Bar and Search Display Controller - The UISearchBar control provides a text field for entering text, a search button, a bookmark button, and a cancel button. The search display controller manages display of a search bar and a table view that displays the results of a search of data managed by another view controller. If the search bar is inserted into a view controller's view, the appropriate connections to the search display controller will automatically be configured.
1.View Controller
一個視圖控制器管理。
繼承自:UIResponder : NSObject
作用:UIViewController管理一個view的最基本的基類最筒,當(dāng)一個view要顯示或者消失的時候哩罪,UIViewController有相應(yīng)方法會被調(diào)用拳球。子類可以重寫loadView方法去創(chuàng)建他們自定義的view,或者指定一個nib被自動加載實(shí)現(xiàn)赴肚。這個類也是對于代理,數(shù)據(jù)源協(xié)議方法和一些其他控制器的方法展示實(shí)現(xiàn)一個很好的空間地方已亥。
2.Navigation Controller
一個控制器管理導(dǎo)航層次結(jié)構(gòu)
繼承自:UIView : UIResponder : NSObject
作用:UINavigationController管理一堆視圖控制器,每個代表一個視圖的信息,比如它的標(biāo)題和與視圖相關(guān)的導(dǎo)航項(xiàng)采蚀。當(dāng)視圖控制器推到和從棧中彈出,導(dǎo)航控制器更新適當(dāng)?shù)膶?dǎo)航欄和視圖疲牵。
3.Table View Controller
一個表格視圖控制器管理。
繼承自:UIViewController : UIResponder : NSObject
作用:UItableViewController創(chuàng)建一個控制器對象,管理一個表格(UItableView)視圖榆鼠。
4.Collection View Controller
一個集合視圖控制器管理纲爸。
繼承自:UIViewController : UIResponder : NSObject
作用:UICollectionViewController代表一個視圖控制器由一個集合視圖組成的內(nèi)容。
5.Tab Bar Controller
控制器管理一組視圖控制器代表標(biāo)簽欄項(xiàng)目璧眠。
繼承自:UIViewController : UIResponder : NSObject
作用:UITabBarController實(shí)現(xiàn)了一個專門的視圖控制器管理radio-style選擇界面缩焦。這個標(biāo)簽欄界面顯示窗口底部的標(biāo)簽之間的選擇不同的模式和顯示的視圖模式。
6.Split View Controller
一個復(fù)合視圖控制器管理左和右視圖控制器责静。
繼承自:UIViewController : UIResponder : NSObject
作用:UISplitViewController一個容器視圖控制器,提出了一種主從復(fù)合結(jié)構(gòu)的界面袁滥。在一個主從復(fù)合結(jié)構(gòu)的界面,主要視圖控制器的變化(主)驅(qū)動器改變第二個視圖控制器(細(xì)節(jié))。這兩個視圖控制器可以安排他們并排,一次只有一個是可見的,或者這只是部分隱藏了另一個灾螃。在iOS 8之后,您可以使用UISplitViewController類所有iOS設(shè)備;在早期版本的iOS,該類只能在iPad上用题翻。
7.Page View Controller
呈現(xiàn)一系列的頁面視圖控制器。
繼承自:UIViewController : UIResponder : NSObject
作用:UIPageViewController讓用戶在頁面之間導(dǎo)航的內(nèi)容,每一頁都由自己的視圖控制器管理對象腰鬼。導(dǎo)航可以由應(yīng)用程序以編程的方式控制或由用戶直接使用手勢嵌赠。當(dāng)導(dǎo)航頁面,頁面視圖控制器使用你指定的過渡動畫改變。
8.GLKit View Controller
一個控制器管理GLKit視圖熄赡。
繼承自:UIViewController : UIResponder : NSObject
作用:GLKViewController提供了所有的標(biāo)準(zhǔn)視圖控制器的功能,但另外實(shí)現(xiàn)一個OpenGL ES呈現(xiàn)循環(huán)姜挺。GLKViewController對象結(jié)合GLKView工作對象在視圖中顯示幀的動畫。
9.AVKit Player View Controller
一個視圖控制器管理AVPlayer對象彼硫。
繼承自:UIViewController : UIResponder : NSObject
作用:AVPlayerViewController顯示的視頻內(nèi)容AVPlayer對象與系統(tǒng)提供的播放控制炊豪。
10.Search Bar and Search Display Controller
搜索顯示控制器管理顯示搜索欄和表視圖顯示一個搜索的結(jié)果數(shù)據(jù)管理的另一個視圖控制器。
繼承自:UIViewController : UIResponder : NSObject
作用:UISearchController專門為UITableView搜索封裝的一個類拧篮。
總述
作為一個iOS開發(fā)者词渤,不但要會用iOS開發(fā)的各種控件,可能還需要了解一些專業(yè)性的術(shù)語串绩,也就是很多公司在招聘的時候會有一些奇葩的面試題缺虐,往往大多面試題就包含了這些。所以礁凡,閑時高氮,多了解一點(diǎn),何嘗不可把篓。