您的位置:首页 > 大数据 > 人工智能

Could not find a storyboard named 'Main' in bundle NSBundle

2016-06-23 09:54 441 查看
xcode6中,因为不想用 storyboard,然后就把创建工程时,默认的 storyboard 给删除了,结果碰到了这种情况,报错是这样的





百度了一下,解决方法是这样的,删掉工程中main.storyboard 后要删除plist文件中对应的键值就可以了





然后在 AppDelegate 里面设置一个 window

.h 文件

#import <UIKit/UIKit.h>
 
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

.m 文件

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}

还有一种情况是我除了删除 stroyboard,还删除了默认的LaunchScreen.xib,删除了这个文件后导致了什么问题呢,就是在屏幕上面和下面留有黑边。

最后找到了一种解决方案添加一张(640*1136)启动图片: Default–568h@2x.png,

不过还有就是你可以新创建一个工程,然后把那个工程的LaunchScreen.xib文件复制过来,在项目设置的 General选项里面,把 Launch Screen File 选择为这个 xib 文件就可以了



 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: