yesterday when i code I am puzzled by a question about contentMode of UIImageView.I want to set UIViewContentModeScaleAspectFill to the UIImageView but the effect of that the image overflow the UIImageView,this is the result:![enter image description here][1]
The red frame is the UIImageView,in the pic we can see the content overflow the UIImageView.Why this happend?
This is the code:![enter image description here][2]
UIImageView* copySmall = [[UIImageView alloc] init];
copySmall.layer.borderColor = [UIColor redColor].CGColor;
copySmall.layer.borderWidth = 1.f;
[copySmall setContentMode:UIViewContentModeScaleAspectFill];
[copySmall setFrame:oriRect];
[copySmall setImage:imgView.image];
Try to set clipToBounds = YES for your imageView