原理:在iOS RootViewController 构建视图的时候添加一个启动图,然后在main.js加载场景后将其移出
1、RootViewController.mm 修改如下代码
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
CGRect bounds = [[UIScreen mainScreen] bounds];
UIImageView *backView = [[UIImageView alloc] initWithFrame: bounds];
UIImage *ima = [UIImage imageNamed:@"xxxxxxx.png"];
[backView setImage:ima];
[self.view addSubview:backView];
}
+(void)removeBackLuanch{
UIViewController *rootVC = [[UIApplication sharedApplication].delegate window].rootViewController;
for(UIView* subview in rootVC.view.subviews){
if([subview isKindOfClass:[UIImageView class]]){
[subview removeFromSuperview];
}
}
}
2、main.js 在第一个场景加载完成后,将其移出
jsb.reflection.callStaticMethod("RootViewController", "removeBackLuanch");