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

相关推荐
瓜子三百克5 小时前
CALayer的异步处理
macos·ios·cocoa
吴Wu涛涛涛涛涛Tao5 小时前
一步到位:用 Very Good CLI × Bloc × go_router 打好 Flutter 工程地基
flutter·ios
杂雾无尘8 小时前
开发者必看:如何在 iOS 应用中完美实现动态自定义字体!
ios·swift·apple
kymjs张涛10 小时前
零一开源|前沿技术周报 #6
前端·ios·harmonyos
与火星的孩子对话1 天前
Unity进阶课程【六】Android、ios、Pad 终端设备打包局域网IP调试、USB调试、性能检测、控制台打印日志等、C#
android·unity·ios·c#·ip
恋猫de小郭2 天前
Flutter Widget Preview 功能已合并到 master,提前在体验毛坯的预览支持
android·flutter·ios
点金石游戏出海2 天前
每周资讯 | Krafton斥资750亿日元收购日本动画公司ADK;《崩坏:星穹铁道》新版本首日登顶iOS畅销榜
游戏·ios·业界资讯·apple·崩坏星穹铁道
旷世奇才李先生2 天前
Swift 安装使用教程
开发语言·ios·swift
90后的晨仔2 天前
Xcode16报错: SDK does not contain 'libarclite' at the path '/Applicati
ios
finger244802 天前
谈一谈iOS线程管理
ios·objective-c