Xcode 4.2新建工程模板詳解
在Xcode4.2中新建一個工程,有三個大類可選:
Application
在這個類別下面,你可以看到下面8種可選類型
下面對這些工程一一說明:
1.Document-Based Application
工程缺省說明如下:
This template provides a starting point for a document-based application. It provides an interface to store documents locally or in iCloud.
這個就是iOS新增的一個重要功能--云計算的一個體現(xiàn),你可以創(chuàng)建一個基于Master-Detail Application類型的工程,不過加入了一個文檔的概念,而且這些文檔可以無縫保存到云端。
我的試驗的結(jié)果是在當前情況下,在虛擬機上運行程序還不能保存到云端。
2.Master-Detail Application
工程缺省說明如下:
This template provides a starting point for a master-detail application. It provides a user interface configured with a navigation controller to display a list of items and also a split view on iPad.
很多有過一些開發(fā)經(jīng)驗的程序員會發(fā)現(xiàn)現(xiàn)在為iPhone的Navigation(導(dǎo)航模式)和為iPad的Split(分割模式)的工程模板沒有了,其實這個地方就是這兩種工程的入口,如果你選擇是iPhone版的Master-Detail Application,其實際生成的就是Navigation(導(dǎo)航模式),如果選擇iPad,則為Split(分割模式)
3.OpenGL Game
工程缺省說明如下:
This template provides a starting point for an OpenGL ES-based game. It provides a view into which you render your OpenGL ES scene, and a timer to allow you to animate the view.
這個是生成一個基于OpenGL的工程,值得說明的是,iOS已全面支持OpenGLES 2.0,并且使用shader編程實現(xiàn)其中的功能。
4.Page-Based Application
工程缺省說明如下:
This template provides a starting point for a page-based application that uses a page view controller.
這個是iOS5引入的一個新的類,page view controller,其翻頁效果是基于OpenGLES實現(xiàn)的。
5.Single View Application
工程缺省說明如下:
This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a storyboard or nib file that contains the view.
這個就是大家很熟悉的View-Based Application,沒啥好說的。
6.Tabbed Application
工程缺省說明如下:
This template provides a starting point for an application that uses a tab bar. It provides a user interface configured with a tab bar controller, and view controllers for the tab bar items.
這個就是大家熟悉的Tab Bar Application,值得一提的就是,現(xiàn)在控制Tab bar內(nèi)容及其相關(guān)View controller都是使用代碼來實現(xiàn)的。Tab bar從一開始就可以使用代碼控制,不過大部分時候可以通過IB來定義,在XCode4.0之前和4.0中,IB在這個地方的使用方式不同?,F(xiàn)在終于要放棄使用IB編輯了。
7.Utility Application
工程缺省說明如下:
This template provides a starting point for a utility application that has a main view and an alternate view. For iPhone, it sets up an Info button to flip the main view to the alternate view. For iPad, it sets up an Info bar button that shows the alternate view in a popover.
這個***新增的就是支持iPad了,而且很少用到這個模板。
8.Empty Application
工程缺省說明如下:
This template provides a starting point for any application. It provides just an application delegate and a window.
這個就是原來的Window-Based Application.
在另外兩個里面,一個是建一個靜態(tài)類庫的工程,一個創(chuàng)建一個完全空的工程。因此在此不再描述。