UIViewContentModeScaleAspectFill not clipping
Can you try setting clip to bounds
[_photoview setClipsToBounds:YES];
Or directly in your Storyboard / Xib if you can :
If you want to expand your knowledge there is a really good article on how the iOS UIView stack is rendered. There is also a more in-depth article about the whole drawing pipeline.
In summary:
Rasterisation - All the view's content is rasterised (drawn or a offscreen pixel buffer) in coordinate space of the View's bounds. This could be image data or custom drawing (i.e.
drawRect:
) but subview content. This rasterisation takes into account thecontentMode
property.Anything outside of a view’s bounds is discarded.
Composition - The results are composited (drawn on top of each other) from subview to superviews. This uses the frame property of the subview.
If the
clipsToBounds
property isYES
on the superview then it will discard subview content outside of its bounds.
Checking "Clip subviews" directly in the Storyboard/Xib also worked for me.
had the same problem and it was resolved by ticking "Clip Subviews".
The image was showing up properly for all views (3.5,4,4.7,5.5,ipad) in storyboard preview but not in the simulator.
After I ticked "Clip Subviews" the problem was resolved. :)