Ios 我可以在xcasset上有2个启动映像吗?
我有一个Images.xcaset,其中包含两个不同的启动图像: LaunchImage和LaunchImage2。在LaunchImages源中,我选择LaunchImages 然后,在AppDelegate inside didFinishLaunchingWithOptions中,我有以下代码:Ios 我可以在xcasset上有2个启动映像吗?,ios,xcasset,launchimage,Ios,Xcasset,Launchimage,我有一个Images.xcaset,其中包含两个不同的启动图像: LaunchImage和LaunchImage2。在LaunchImages源中,我选择LaunchImages 然后,在AppDelegate inside didFinishLaunchingWithOptions中,我有以下代码: splashView= [[UIImageView alloc] initWithFrame:([[UIScreen mainScreen] bounds])]; NSMutableAr
splashView= [[UIImageView alloc] initWithFrame:([[UIScreen mainScreen] bounds])];
NSMutableArray *images = [[NSMutableArray alloc] init];
[images addObject:[UIImage imageNamed:@"LaunchImage"]];
[images addObject:[UIImage imageNamed:@"LaunchImage2"]];
[self.window addSubview:splashView];
[self.window bringSubviewToFront:splashView];
splashView.animationImages = images;
splashView.animationDuration = 2;
splashView.animationRepeatCount = 1;
[splashView startAnimating];
尝试检索LaunchImage2时出现错误。我怀疑这是因为它没有复制到包中。它不应该是应该复制xcasset中的所有图像
我得到的错误如下:
*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'*-[\uu NSArrayM insertObject:atIndex:]:对象不能为零'您不能在xcasset上放置两个启动映像。看到这一点,您可以使用删除启动图像并将您选择的屏幕图像放置在第一个viewcontroller上。这应该可以工作,您会遇到什么错误?为什么不使用LaunchScreen.Storyboard?问题是我要做的是:应用程序在启动屏幕中加载图像,然后通过动画,我将同一张可见图像保留几秒钟,然后换成另一张,但我需要第二张图像的大小合适。