我正在执行以下操作来确定块期间下载图像的大小,然后我将相应地设置 uiimageview 的大小。
self.headerView 是 xib 中 uiimageview 的出口连接
__weak UIImageView *weakObj = self.headerView;
[self.headerView setImageWithURLRequest:[NSMutableURLRequest requestWithURL:[NSURL URLWithString:fundraiserInfo.imageUrl]]
placeholderImage:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
NSLog(@"image is %@",NSStringFromCGSize(image.size));
CGRect newFrame ;
newFrame = weakObj.frame;
newFrame.size.width = image.size.width;
newFrame.size.height = image.size.height;
weakObj.frame = newFrame;
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
;
}
];
但是,当在模拟器(Device-Iphone)上运行应用程序时,我得到了
image is {300, 222}
但是,如果我使用模拟器 (Retina 3.5) 或 (Retina 4) 或者我在 iphone4 或 iphone 5 上安装应用程序,我会得到:
image is {150, 111}
为什么会这样。