Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 以编程方式加载启动映像_Ios_Xcode - Fatal编程技术网

Ios 以编程方式加载启动映像

Ios 以编程方式加载启动映像,ios,xcode,Ios,Xcode,现在看来,为了显示launchimage.xib,必须在构建设置中为“启动屏幕文件”字段设置启动图像文件名(launchimage.xib)。是否可以改为: 动态加载启动映像,和/或 是否将操作与启动映像关联 我认为无法动态加载启动映像。但是,您可以使用以下代码访问添加到应用程序中的启动图像。您还可以检查它是否与您的设备规模和大小相匹配 NSArray *allPngImageNames = [[NSBundle mainBundle] pathsForResourcesOfType:@"pn

现在看来,为了显示
launchimage.xib
,必须在构建设置中为“启动屏幕文件”字段设置启动图像文件名(
launchimage.xib
)。是否可以改为:

  • 动态加载启动映像,和/或
  • 是否将操作与启动映像关联

我认为无法动态加载启动映像。但是,您可以使用以下代码访问添加到应用程序中的启动图像。您还可以检查它是否与您的设备规模和大小相匹配

NSArray *allPngImageNames = [[NSBundle mainBundle] pathsForResourcesOfType:@"png"
                                    inDirectory:nil];

for (NSString *imgName in allPngImageNames){
// Find launch images
if ([imgName containsString:@"LaunchImage"]){
    UIImage *img = [UIImage imageNamed:imgName]; //-- this is a launch image

    // Has image same scale and dimensions as our current device's screen?
    if (img.scale == [UIScreen mainScreen].scale && CGSizeEqualToSize(img.size, [UIScreen mainScreen].bounds.size)) {
        NSLog(@"Found launch image for current device %@", img.description);
    }
  }
}

但是我不相信这会对你有多大帮助

发布图像(或故事板)是由应用程序启动器处理的,而不是应用程序本身。因此,我看不到加载动态启动映像或附加操作的方法。位于的文档除了使用故事板或静态图像外,没有为您的启动屏幕提供任何选项。

谢谢@Ganesh--我正在寻找动态启动选项,即,如果将文件名传递给应用程序,它应该加载该文件名.xib而不是默认启动图像。这在编程上是不可能的。还有其他问题的答案和答案相似