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,两个步骤完事!

相关推荐
Kapaseker16 小时前
Swift 构建 Android 应用?它来了
ios·swift
Digitally21 小时前
11种方法解决iPhone上共享相册不显示的问题[2025]
ios·iphone
Swift社区1 天前
iOS 基于 Foundation Model 构建媒体流
ios·iphone·swift·媒体
库奇噜啦呼1 天前
【iOS】音频与视频播放
ios·音视频·cocoa
大熊猫侯佩2 天前
黑衣人档案:用 Apple Foundation Models + SwiftUI 打造 AI 聊天机器人全攻略
ios·swiftui·ai编程
大熊猫侯佩2 天前
侠客行・iOS 26 Liquid Glass TabBar 破阵记
ios·swiftui·swift
2501_916007472 天前
手机使用过的痕迹能查到吗?完整查询指南与步骤
android·ios·智能手机·小程序·uni-app·iphone·webview
從南走到北2 天前
JAVA国际版同城外卖跑腿团购到店跑腿多合一APP系统源码支持Android+IOS+H5
android·java·ios·微信小程序·小程序
alengan2 天前
苹果企业签名流程
ios·iphone
Digitally2 天前
如何在Mac上同步iPhone短信
macos·ios·iphone