xcode template

1. 工程项目模板类型的更改

          Xcode4时代                                           Xcode4+新模板
Navigation-based Application  ------->Master-Detail Application => iphone

Splite View-based Application ------->Master-Detail Application => ipad

OpenGL ES Application --------------->OpenGL Game

Tab Bar Application      --------------->Tabbed Application

Utility Application         --------------->Utility Application

View-based Application --------------->Single View Application

Window-based Application------------>Empty Application

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.

如果你选择是iPhone版的Master-Detail Application,其实际生成的就是Navigation(导航模式:内建一个导航控件,这个空间提供了后退按钮,标题栏和一份视图导航的历史,在视图之间提供动画形式的转场),如果选择iPad,则为Split(分割模式)。

两个重要的文件:

RootViewController:master view controller,在iPad上出现在左侧,在iPhone上是用户看见的第一个view controller

DetailVieweController: iPad右侧,iPhone上用户触碰master view controller后出现的。

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编程实现其中的功能。

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实现的。

Delegate Class:创建RootViewController çlass 的实例,并展示给用户。

RootViewController:创建UIPageViewController的实例,并将其add到itself。UIPageViewControllerDelegate,这样RootViewController就成了Delegate

DataViewController:是UIViewController的子类,将每一页presented to users.

ModelController:NSObject的子类,遵守UIPageViewControllerDataSource协议,是page view controller的数据源。这样ModelController成了数据源。

 

UIPageViewController delegate methods:

1.当用户移到下一页,上一页或者在翻也的过程中想放弃的时候调用:

- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed{} transitionCompleted是YES代表完成翻页,NO代表用户放弃翻页在翻页这个动作进行的过程中。

2.设备的方向改变是调用:

- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation{}    返回UIPageViewControllerSpineLocation类型的值,

      enum { UIPageViewControllerSpineLocationNone = 0,

          UIPageViewControllerSpineLocationMid = 1, //展示一个view controller,即一页

          UIPageViewControllerSpineLocationMid = 2,//两个,两页

          UIPageViewControllerSpineLocationMax = 3

          };

          typedefy NSInteger  UIPageViewControllerSpineLocation;

UIPageViewControllerDataSource协议的两个重要方法:

1.当屏幕上已经有一个view controller时需要知道哪个是前一个的controller,这种情况发生在用户决定划到下一页时,此时调用

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController{}

2. 需要知道用户划到下一页时,那个view controller被展现给用户时调用

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController{}

 

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,值得一提的就是,现在控制Tab bar内容及其相关View controller都是使用代码来实现的。Tab bar从一开始就可以使用代码控制,不过大部分时候可以通过IB来定义,在XCode4.0之前和4.0中,IB在这个地方的使用方式不同。

7.Utility Application: ios SDK Essential Train 45

工程缺省说明如下:

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.

原文地址:https://www.cnblogs.com/liuhong/p/3277643.html