1.Could not find a storyboard named 'Main' in bundle NSBundle
场景:当使用Xcode 6.1 的 Single View Application 模版创建工程时,不想使用故事模板,直接删除main.storyboard报错。
(1)调试:删掉格式文件Info.plist中对应的键值,即删掉Main storyboard file base name...main 这行
(2) 添加新的视图
a.删除原先的控制类ViewController.h和ViewController.m
b.添加新的控制类RootViewController.h和RootViewController.m及命名为MyRootVC.xib的xib文件
c.在代理文件AppDelegate中添加窗口视图和根视图,方法如下:在AppDelegate.h中添加属性,即
@property (strong,nonatomic)RootViewController *MyRootVC;
d.在在AppDelegate.m中的didFinishLaunchingWithOptions方法内添加以下代码:
self.window = [[UIWindowalloc] initWithFrame:[UIScreenmainScreen].bounds]; //创建新的窗口
self.MyRootVC = [[RootViewControlleralloc] initWithNibName:@"MyRootVC"bundle:nil]; //创建新的视图
self.window.rootViewController =self.MyRootVC; //设置根视图
[self.windowmakeKeyAndVisible]; //显示窗口