0

I am building a prank mobile application that simulate the mobile home screen.

When the user start the application it looks similar to the actual home screen.

I am going to do this by laying down images of icons in a grid. These images would be common icons that found in mobile phone screen eg: mail, camera, photos etc.

I already know the width and height of the screen. But I have to resize the icon images to a size same as the actual home screen icons .

The question I have is , is there a way to figure icon sizes from the screen resolution?

Janaka
  • 2,505
  • 4
  • 33
  • 57

3 Answers3

1

So you have an info about the screen resolution, and your app is an iOS mobile app; and you want to know the size of home screen icons based on this information.

In the documentation by Apple on Human Interface Guidelines, the section on App Icon says that for iPhone, icons sizes are the following:

180px x 180px (60pt x 60pt @3x)

120px × 120px (60pt × 60pt @2x)

This answers your question.

To find out more, you may visit the documentation

Asol
  • 349
  • 3
  • 9
  • #Asol thank you for your answer. It seems there are 2 sizes for iPhone. How do I identify which size goes to which resolution? – Janaka Feb 23 '21 at 09:10
  • The way I am gong to do this is to draw all on the screen. To do this I need to know exact width and heights – Janaka Feb 23 '21 at 09:13
  • By two sizes, you mean **pt** (points) and **px** (pixels)? There is only 1 size for each resolution (@). The coordinate system iOS uses to place content onscreen is based on measurements in **points**, which map to pixels in the display. So there is just conversion happening: @1, a standard resolution, 1 point = 1 px; @2, 1 point = 2 px; @3, 1 point = 3 px. – Asol Feb 23 '21 at 09:26
  • I was referring to 180 and 120 – Janaka Feb 23 '21 at 10:07
0

Images are sizable by 1x 2x and 3x it will adjust the users resolution you don't have to do any thing else

Giovanni Gaffé
  • 36
  • 1
  • 1
  • 10
  • thank you for your answer. The way I am doing this I really need to figure out icon size based on screen resolution. – Janaka Feb 22 '21 at 14:28
0

If you really want to know the icon sizes. You can use below code.

let iconImage = UIImage(named: "name_of_image")!

let heightPoints = iconImage.size.height
let heightPixel = heightPoints * iconImage.scale

let widthPoints = iconImage.size.width
let widthPixel = widthPoints * iconImage.scale
  • #Ashish Kr Singh thank you for your answer. I don't have access to the UIImage. Basically what I need is home screen icon width and height based on screen resolution. – Janaka Feb 23 '21 at 12:25