我UIImageView
与contentMode = UIViewContentModeScaleAspectFit
当contentMode UIViewContentModeScaleAspectFit
禁用的UIImageView调整行为,我需要这个模式才能正常显示我的形象。 但我也需要imageView裁剪图像时,其框架更改像UIViewContentModeTopLeft
。
我怎么能得到这个?
编辑:
imageView.contentMode = UIViewContentModeTopLeft;
imageView.image = someImage;
现在我得到这个(和它的确定,图像缩放正确,看起来不错):
然后,我有方法:
- (void)setRating:(double)rating {
double starWidth = imageView.image.size.width/_maxRating;
CGRect oldFrame = self.frame;
imageView.frame = CGRectMake(0, 0, rating * starWidth, oldFrame.size.height);
_rating = rating;
}
此方法后,我需要得到类似的东西:
但由于UIViewContentModeScaleAspectFit
我得到缩放后的图像
发表一些代码:) – Rushabh 2013-03-13 12:55:40
你想得到什么? – 08442 2013-03-13 12:56:27
编辑。希望它会给一些清晰度 – user1248568 2013-03-13 13:35:17