4

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!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Zhaowei Wu
  • 115
  • 2
  • 8
  • 1
    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? – Devbot10 Nov 01 '18 at 20:45
  • @Devbot10 https://www.google.com/search?client=safari&rls=en&tbm=isch&q=home+indicator&spell=1&sa=X&ved=0ahUKEwi40f-pnbbeAhVoTt8KHW8PCrEQBQg9KAA&biw=1265&bih=667&dpr=2 here – Zhaowei Wu Nov 02 '18 at 17:27

2 Answers2

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.

Erick Olibo
  • 71
  • 2
  • 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. – Lance Samaria May 22 '20 at 13:40
  • 1
    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. – Erick Olibo May 24 '20 at 09:24
  • 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!!! – Lance Samaria May 24 '20 at 09:27
  • 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. – Erick Olibo May 25 '20 at 10:05
  • I didn’t realize that. You did a great job with the photo!!! Thanks for helping, cheers – Lance Samaria May 29 '20 at 12:19
  • 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://stackoverflow.com/a/46829094/4833705. Cheers! – Lance Samaria Jul 20 '20 at 12:17
0

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.

Sean Goudarzi
  • 1,244
  • 1
  • 10
  • 23