iOS 删除stroryboard

来源:互联网 发布:maven 设置java home 编辑:程序博客网 时间:2024/06/06 07:45

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
0 0