IOS不使用默认的mainStroryboard作为首个controller的方法

步骤1:

删除info.plist文件下的一条配置,如图

步骤2:

编辑AppDelegate.m,参考以下代码

复制代码
@interface AppDelegate ()
//@property (strong, nonatomic) UIWindow * window;
@property(nonatomic,strong) UIWindow * win;
@property(nonatomic,strong) MyViewController * mainVC;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
	// 创建自己的window
    self.win = [[UIWindow alloc]initWithFrame:UIScreen.mainScreen.bounds];
    // 创建主controller
    self.mainVC = [MyViewController new];
    // 创建导航,可选
    UINavigationController * nav = [[UINavigationController alloc]initWithRootViewController:_mainVC];
    self.win.rootViewController = nav;
    [self.win makeKeyAndVisible];
    return YES;
}

OK,两个步骤完事!

相关推荐
初级代码游戏4 天前
easy Photo Clean公测版:快速清理iPhone照片 邀请公测
ios·iphone
库奇噜啦呼4 天前
【iOS】RunLoop学习
学习·ios
黑科技iOS上架4 天前
iOS应用周末提交什么情况算卡审
经验分享·ios
zzb15804 天前
ios基础-MVC-UIView
ios·mvc·cocoa
kingbal4 天前
Flutter:Flutter SDK版本管理工具FVM
android·flutter·ios·android-studio·window
他们都不看好你,偏偏你最不争气5 天前
【iOS】Runtime - Part 2 && 消息发送:缓存、查找与转发
macos·ios·objective-c·cocoa
2501_915918415 天前
iOS App性能测试工具的实现方法与优化循环指南
android·ios·小程序·https·uni-app·iphone·webview
他们都不看好你,偏偏你最不争气5 天前
【iOS】Runtime - Part 1 && 对象与类的本质
macos·ios·objective-c·cocoa