Search code examples
iphoneuiimageviewscalinginterpolation

UIImageView scaling/interpolation


I have a small IPhone app that I am working on and I am displaying an image with a UIImageView. I am scaling it up using the Aspect Fit mode. I would like to have the image scale up with no interpolation/smoothing (I want it to look pixellated). Is there any way I can change this behavior?

A little more general question would be can I implement my own scaling algorithm, or are there other built in ones that I can select?


Solution

  • You would need to set the magnificationFilter property on the view's layer to the nearest neighbour filter:

    [[view layer] setMagnificationFilter:kCAFilterNearest]