当新建一个工程后.经过以下步骤:
1. 在代理类里增加代码一般没有什么难度,看帮助文档就可以做.
2. 主要的步骤是设置MainWindow.xib文件和你的View.xib文件.
MainWindow的Outlet属性里,有两个属性,一个是ViewController,这个要指向你定义的ViewController.
一个是window. 这个一般会指向系统的Window类.
还有一个就是Referencing Outlet: Delegate要指向FileOwner.而MainWindow的File Owner就是UIApplication.
3. 系统模板建立的MainWindow.xib文件里,不包括ViewController,这个需要自己添加一个视图控制类.然后,把这个类的Class指向
你自己增加的ViewController.h.m类.
4.然后自己要再增加一个View.xib,这个文件的File Owner一定要修改,默认的是NSObject.
5. 最为重要的是,每个ViewController都有个内定的View Outlet,这个一定要加进去.否则你会遇到类似一下的错误.
告诉你View Outlet没有设定.就是因为这个.
================================
terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MyView" nib but the view outlet was not set