In iOS, all the dimensions for placing any content on the screen is based on points, which map to pixels in the display.
Device | Scale factor |
---|---|
iPhone X, iPhone 8 Plus, iPhone 7 Plus, and iPhone 6s Plus | @3x |
All other high-resolution iOS devices | @2x |
All iOS applications you develop in Xcode will show up on the home screen using the default application icon.
So whether you test your app on a physical device or just run the app in the simulator, you will see this generic icon, white with gridlines. Every app must supply small icons for use on the Home screen and throughout the system once your app is installed, as well as a larger icon for display in the App Store.
Device | Icon size |
---|---|
App Store | 1024px x 1024px (1024pt x 1024pt @1x) |
iPhone | 180px x 180px (60pt x 60pt @3x) 120px x 120px (60pt x 60pt @2x) |
iPad Pro | 167px x 167px (83.5pt x 83.5pt @2x) |
iPad, iPad mini | 152px x 152px (76pt x 76pt @2x) |
Let's go to the XCode and click on Assets.xcassets file. It is designed to make your life easier when you're working with images for iOS applications that are supposed to be provided at those multiple different scales.
<img alt="image" src="https://raw.githubusercontent.com/zzzprojects/learn-orm/master/tutorials/ios/images/app-icon2.png"alt="App icon-2">
Select the 2x and open attributes inspector.
It will tell you, even more, this works for an iPhone, for an iPad, it's not relevant for the Apple Watch. It tells you what Size is and what Scale should be.
We have two icons for our task list app, one of them at 120 x 120, and the other is 180 x 180.
Let's drag the 3x into the 3x placeholder, the 2x into the 2x placeholder.
Now run your application and tap the home button and you will see a new application icon.