Incorrect height for Screen.Size?

While debugging a different problem, I ran into this puzzle:

I want to get the true screen size (no nav bar, home indicator, etc.), but I’m getting different sizes. Screen.Size is reporting a value that’s larger when the Nav Bar is visible:

According to the docs for MobileScreen, .Size is “the size (in points) of the entire Screen area,” so there’s shouldn’t be any change in value because of the Nav Bar.

Happy to file a bug report if this is what it is, but if anyone has a workaround, that would be awesome.

1 Like

Yep, looks like a bug.

Feedback: https://tracker.xojo.com/xojoinc/xojo/-/issues/71069

Workaround:

// Quickly toggle the navbar visiblity to get the correct screen height
Dim hasNav As Boolean = Me.HasNavigationBar
Me.HasNavigationBar = False
Dim s0 As Size = Me.Size
Me.HasNavigationBar = hasNav
1 Like