How can I get the size (width, height) of the iPhone X home indicator?
Asked Answered
G

2

6

I want to know the dimensions of the home indicator bar for iPhone X / XR / Xmax. Is there any way to get those constants? Thanks!

Geosynclinal answered 1/11, 2018 at 20:42 Comment(2)
What do you mean home indicator bar? Are you referring to the bar where you are able to place apps on the home screen at the bottom?Appreciation
@Devbot10 google.com/… hereGeosynclinal
S
7

Visual Representation of The Home Indicator Width and Height

I was looking for this today, not as a coding stand point but design. I do not know of an Apple public or private API that allows to get this information. I can't think of a coding situation where i would need it.:)

The Home indicator safe area is 34pts and the total including the Tab Bar, if any, is 83pts (Apple HIG).

I have calculated this myself using photoshop and pixel accurate representation of a iPhone Xs max and Xs views.

  • Below the Home indicator -> 8pts
  • Home indicator height -> 5pts
  • Home indicator width -> Xs Max = 148pts & Xs = 134pts

I know the post is about 8 months old, but this was google top 5 search results. Hope it serves someone.

Skunk answered 17/6, 2019 at 21:35 Comment(6)
Thanks for your helpful answer. You should take a screenshot of the pic from that link and add it to your answer. If the links goes down then we won't see it.Ways
Thanks @LanceSamaria, I have edited the post and image. When I wrote this answer I didn't have enough reputation points for the picture to show. But now it's all good.Skunk
You still should’ve left the link up to provide credit to the creator. I was suggesting add the pic in addition to the link. But whatever whatever works for you. Cheers!!!Ways
Hey @LanceSamaria, I'm the creator of the pic at the time I provided the solution (photoshop). The link was provided automatically by SO when I uploaded it.Skunk
I didn’t realize that. You did a great job with the photo!!! Thanks for helping, cheers 🍻🍻Ways
I ran across this and remembered your great answer. Here's how you get the size of the HomeIndicator in code. It's better than hard coding it in case the size ever changes: https://mcmap.net/q/344625/-extra-bottom-space-padding-on-iphone-x. Cheers!Ways
I
1

There's a hack you can do, and it doens't exactly give you the height of the home indicator, but it does give the exact bounds (and height) of the area around the home indicator (which in many use cases people need this). Create a dummy view, constraint the bottom to the bottom of the screen, and its top to the main view's safe area layout guide's bottom. Wait for the view to be drawn, and get its frame property's height.

Incurrence answered 14/1, 2021 at 13:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.