How to display a pixel art image in Xcode 7 without it anti-Aliasing

Viewed 1067

I'm new to Xcode so please be patient with me! :)

(using Swift 2.1, OSX 10.11.2 El Capitan and Xcode 7.2 I am not using sprite kit or anything like that, I'm just using a single page application)

I'm trying to make a pixel art game but whenever I create a UIImageView and set the image to my pixel art png file, it makes the image all blurry, here is a screenshot of it:

enter image description here

as you can see in the Preview window (right) the image is crisp and clean, and in the Xcode window (left) the image is blurry and fuzzy

Can someone please tell me how to fix this?

2 Answers

In swift 5 you can do the following to change the filtering mode:

texture?.filteringMode = SKTextureFilteringMode.nearest

This will disable anti-aliasing for the selected texture.

Related