简体   繁体   中英

How to find home screen icon size from screen resolution

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?

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM