开发者

how to load the local image using lazyimageview

im using LazyImageView open source class to load the image

albumArtImgV.frame = CGRectMake(1, 1, bImgSize, bImgSize);
 NSString *filePath = [[NSBundle mainBundle] pathForResource:@"disc" ofType:@"png"];
 NSLog(@"disc path..%@",filePath);
 [albumArtImgV loadImageFromURL: [NSURL URLWithString:filePath]];
       [albumArtImgV loadImageFromURL:[NSURL URLWithString:someurl]];

in the above code im loading the local image开发者_如何转开发, later i am loading the image from network. my intention is if there is no image in the network my local image will be displayed. but its not loading the local image. all other network images are loading.

1>> i found that.. the url for the local image path is 'nil'. how to make a nsurl with the local bunlde path of the file.?

2>>

filePath = [filePath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

now the url is not nil.. though its not loading.

thanks.


[albumArtImgV loadImageFromURL: [NSURL URLWithString:filePath]]; [albumArtImgV loadImageFromURL:[NSURL URLWithString:someurl]];

being called one after the other replaces the directive to load local image. I am not aware of the source code you are referring to but this should work

albumArtImgV.image = [UIImage imageNamed:@"disc.png"]; [albumArtImgV loadImageFromURL:[NSURL URLWithString:someurl]];

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜