新建項目后,希望把默認的Main.storyboard和LaunchScreen.storyboard刪除,刪除后上下出現黑邊。
刪除Main.storyboard和LaunchScreen.storyboard
1.png
刪除后改下這兩個地方(改為空)
2.png
AppDelegate.m (記得根視圖要設置顏色,否則還是黑色)
#import "AppDelegate.h"
#import "ViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = [[ViewController alloc] init];
[self.window makeKeyAndVisible];
return YES;
}
然后運行發現上下黑邊
3.png
在info.plist中設置
6.png
在運行程序
4.png