Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Using different images for different retina displays

I was wondering how would you serve up different quality images i.e @2x, @3x etc in swift and Xcode would you check the screen quality and change the image box or just create one image at the largest size and use this instead i'm a bit confused on this could anyone offer any insight

1 Answer

In Xcode, you can navigate to Images.xcassets. Once you are in there, click the plus icon to add a new Icon Set. There will be three boxes for orginal, @2x, and @3x sizes. In interface builder, reference the image by using the Icon Set name. Xcode will automatically choose the right resolution photo depending on what device is being used.

ahhh okay thanks