myang-git / iOS-Image-Crop-View

A view that allows user to select the cropping area in an image
383 stars 78 forks source link

ImageView and blurred image views can have different frames, causing weird 'zoom' effect #24

Closed ivo-ranj closed 8 years ago

ivo-ranj commented 8 years ago

With some (large) photos, the imageView and blurredImageView versions of the image can have different frames, causing a weird "zoom in" effect where the blurred version of the image fits nicely but the underlying non-blurred version doesn't fit the screen.

Seen on iPhone 5c with photos (both landscape and portrait) taken on this device.

Solution is to set the image after setting the contentMode and clipsToBounds, as follows (within setImage method):

    /* prepare imageviews and their frame */
    self.shadeView.blurredImageView.contentMode = UIViewContentModeScaleAspectFill;
    imageView.contentMode = UIViewContentModeScaleAspectFill;
    imageView.clipsToBounds = YES;
    self.shadeView.blurredImageView.clipsToBounds = YES;

    imageView.image = image;

Looks like otherwise the aspect fill scaling is not performed.

sunshineo commented 8 years ago

This one https://github.com/azzikid/BFCropInterface uses 9 frames and the one in the middle is the cropped view. Very interesting idea and less trouble I feel.