开发者

loading images from plist

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜