creator iOS 启动第一个场景前的短暂黑屏

原理:在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");

posted on 2019-04-01 17:48  孤傲的蜗牛  阅读(434)  评论(0)    收藏  举报

导航