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顯示任何代碼 –