I solved this problem like this.
UIImageView
(with UIViewContentModeScaleAspectFit
)(CGSize imageSize = imageView.image.size)
UIImageView
resize. [imageView sizeThatFits:imageSize]
I wanted to put UIView on the top center of UICollectionViewCell
.
so, I used this function.
- (void)setImageToCenter:(UIImageView *)imageView
{
CGSize imageSize = imageView.image.size;
[imageView sizeThatFits:imageSize];
CGPoint imageViewCenter = imageView.center;
imageViewCenter.x = CGRectGetMidX(self.contentView.frame);
[imageView setCenter:imageViewCenter];
}
It works for me.