2012-12-17 36 views
0

我可以通過AsyncImageView從url中獲取圖像大小的任何方法嗎?這是我到目前爲止的代碼:AsyncImageView未完成調整大小

NSLog(@"image x:%f y:%f", _imageView.frame.origin.x, _imageView.frame.origin.y); 
NSLog(@"image w:%f h:%f", _imageView.frame.size.width, _imageView.frame.size.height); 
NSLog(@"image w:%f h:%f", _imageView.image.size.width, _imageView.image.size.height); 


_imageView.image = [UIImage imageNamed:@"Placeholder.png"]; 


//cancel loading previous image for cell 
[[AsyncImageLoader sharedLoader] cancelLoadingImagesForTarget:_imageView]; 

//load the image 
_imageView.imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",[AppSetting getPkParkingPhotoPath],[_data objectForKey:@"photo"]]]; 

_imageView.contentMode = UIViewContentModeScaleAspectFill; 

NSLog(@"image x:%f y:%f", _imageView.frame.origin.x, _imageView.frame.origin.y); 
NSLog(@"image w:%f h:%f", _imageView.image.size.width, _imageView.image.size.height); 

我想要得到的圖像的實際尺寸和調整&適合寬度和高度動態。 我該如何委託方法AsyncImageView

回答

0

嘗試使用此

_imageView.contentMode = UIViewContentModeRedraw;

+0

但是如何獲得維度?據我所知,我可以在加載照片後得到寬度和高度......但我可以使用任何onComplete方法來做到這一點? –