2011-09-01 90 views

回答

0

物业UIImageViewframe将返回所显示的图像的帧。

如果你想改变框架,你应该刚刚成立的新CGRect frameUIImageView

例如:

UIImageView *imgView; 
imgView.frame = CGRectMake(0, 0, newWidth, newHeight); 

更新时间:

要计算新的大小,你可以使用下面的代码:

UIImage *img; 
UIImageView *iView;  
double widthRatio = img.size.width/iView.frame.size.width; 
double heightRatio = img.size.height/iView.frame.size.height; 
double ratio = widthRatio>heightRatio?widthRatio:heightRatio; 
CGSize newImageSize; 
newImageSize.width = img.size.width/ratio; 
newImageSize.height = img.size.height/ratio; 
+0

我知道,我正在寻找newWidht和th e newHeight(调整大小后的图像) –

+0

'UIImageView.frame'会给你'调整图像大小' – Nekto

+0

nope它给出原始定义的帧。 –