【发布时间】:2012-12-03 06:28:44
【问题描述】:
好的,我有一个包含图像文件夹的 FTP 服务器。这个图像文件夹并不总是相同的。图像的数量可能与文件名不同。我可以使用NSURL 和NSData 使用一个图像文件的特定路径将图像加载到我的UIImageView 中,但是我需要从文件夹中获取所有图像,而不仅仅是一个这样我就可以轻松滑动浏览不同的图像。有没有办法我可以获取目录的文件夹并将该文件夹中的所有图像作为数据对象放入NSArray?下面是我用来将一张图片放入我的UIImageView 的代码。
//This works for loading the one image with a specific full path to the file.
NSURL * url = [NSURL URLWithString:@"ftp://myftpServeruserpassportandpath"];
NSData * data = [[NSData alloc]initWithContentsOfURL:url];
UIImage * image = [[UIImage alloc]initWithData:data];
[self.imageView setImage:image];
感谢任何帮助或建议。
【问题讨论】:
标签: objective-c xcode uiimageview xcode4.5