您的位置:首页 > 移动开发 > IOS开发

iOS 删除stroryboard

2016-04-01 16:15 561 查看

Xcode移除”main.storyboard”以及”LaunchScreen.storyboard”

1、删除项目中的“main.storyboard”、“LaunchScreen.storyboard”的两个文件



2、移除“info.plist”文件中的“Launch screen interface file base name”和“Main storyboard file base name”两个节点



3、编辑“AppDelegate.m”文件中“didFinishLaunchingWithOptions”

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
YourViewController *yourVC = [[YourViewController alloc] init];
UINavigationController *loginNav = [[UINavigationController alloc] yourVC];
self.window.rootViewController = loginNav;
[self.window makeKeyAndVisible];
return YES;
}


补充:

删除完“main.storyboard”、“LaunchScreen.storyboard”的两个文件之后可能出出现屏幕上下有黑边的情况,出现这种情况有一下两种解决办法

第一种:只删除“main.storyboard”文件,保留“LaunchScreen.storyboard”

第二种:在“Assets.xcassets”中添加“LaunchImage”(如果之前有的话,则不用添加),然后在“LaunchImage”加入对应的图片:

iPhone 4s (retina @2x) 640 x 960

iPhone 5 (@2x): 640 x 1136

iPhone 6 (@2x): 750 x 1334

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