我想使用AsyncImageView从URL加载和映像,然后将此图像添加到UIView。我已经检索了我的URL但是当我尝试使用方法loadImageWithURL时我不能,因为它没有在AsyncImageView的接口中声明,而是在AsyncImageLoader中声明。我应该使用AsyncImageLoader接口吗?任何人都可以帮我弄清楚如何修改我的代码来做到这一点吗?
使用代码链接到图像:
- (void)viewDidLoad {
CGRect frame = image.frame;
AsyncImageView* asyncImage = [[AsyncImageView alloc] initWithFrame:frame];
asyncImage.tag = 999;
AppDelegate *thisDelegate = [[UIApplication sharedApplication] delegate];
if (thisDelegate.isEchoesUser == YES) {
url = [NSURL URLWithString:[[NSString stringWithFormat:@"%@%@", ECHOES_REST_SERVICE_THUMB3,
[imageURL stringByReplacingOccurrencesOfString:ECHOES_REST_ADDRESS withString:@""]]
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
}else if (thisDelegate.isEchoesUser == NO){
url = [NSURL URLWithString:[[NSString stringWithFormat:@"%@%@", REST_SERVICE_THUMB3,
[imageURL stringByReplacingOccurrencesOfString:REST_ADDRESS withString:@""]]
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
}
[asyncImage loadImageWithURL:url];
[image addSubview:asyncImage];
// Set the caption;
[caption setText:captionText];
[super viewDidLoad];
}
答案 0 :(得分:0)
使用AsyncImageLoader代替,AsyncImageView没有此功能