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");
creator iOS 啟動第一個場景前的短暫黑屏