0
当我使用setImageWithURL加载在线图像时,我得到了0.000000, ,但是当我加载本地图像时,我得到了正确的宽度。使用SDWebImage为imageview加载图像,如何获取图像的宽度?
NSURL * url1=[NSURL URLWithString:@"http://img.hb.aicdn.com/7f46b5eb65320f18f797a4a26ebe9ba328b547832f7b3-KYR0Xn_fw192"];
UIImageView * img2=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 192,400)];
[img2 setImageWithURL:url1];
//[img2 setImage:[UIImage imageNamed:@"0.gif"]];
//load local image
[self.view addSubview:img2];
CGFloat height1=img2.image.size.width;
NSLog(@"%f",height1);
你不用SDWebImage显示任何代码 –