开发者

loading images from plist

开发者 https://www.devze.com 2023-01-23 10:55 出处:网络
I am loading the images from a server like this... - (id)init { self = [ super init ]; if (self != nil) {

I am loading the images from a server like this...

- (id)init {
self = [ super init ];
if (self != nil) {
    covers = [ [ NSMutableArray alloc ] init ];

    for(int i = 1; i < 6; i++) {
        NSLog(@"Loading demo image %d\n", i);
        UIImage *image = [ [ UIImage alloc ] initWithData:
                          [ NSData dataWithContentsOfURL:
                           [ NSURL URLWithString: [ NSString stringWithFormat:
                                                   @"http://www.xyz.com/1%d.png", i ] ] ]
                          ];





        [ covers addObject: image ];
开发者_Python百科    }
}
return self;

}

Now i want to load the images from plist file instead of url. Can anyone plz tell me how to do it... Plz help...


Property List can manage NSData and UIImage can be create from NSData:

+ (UIImage *)imageWithData:(NSData *)data

But I din't think it is the best way to do this. You can save image file and reference the file in plist.

0

精彩评论

暂无评论...
验证码 换一张
取 消