![](/img/trans.png)
[英]How to load and animate images from Images.xcassets folder using UIImage array in objective c
[英]How to load images in UIImage array from an online directory and store them in the App
我想从网站启动应用程序时加载多个图像(即http://hello.com/images/中的所有图像,分别命名为1.png,2.png,3.png ..),以便这些图像可以在程序中的任何位置使用,而无需每次我要访问它们时都重新加载它们。
我可以简单地创建一个包含静态NSArray的类并在开始时填充它,然后在需要图像时创建该类的实例,或者有更好的方法吗?
现在,我正在使用以下代码加载图像:
UIImage *image =[[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://hello.com/images/%@.png,item]]]];
我想使该应用程序尽可能高效,因此我担心创建多个对象使其要求很高。
谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.