Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Wrong Safe Area Insets on iPad Simulators in Landscape Mode?
Started by RayCardillo Jan 05 2019 10:24 PM

4 replies to this topic
safe area insets insets safe area
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

RayCardillo

[GLOBAL: userInfoPane.html]
RayCardillo
  • Observer

  • 19 posts
  • Corona SDK

While running through the resolutions to test some changes to support the new safe area insets features, I noticed that the "top" seems incorrect in the simulator for the iPad devices. From what I understood, none of the original iPads (represented in the simulator) have any insets we need to be concerned with and it should really only affect the iPhone X type of displays in the simulator right now (and maybe some TV devices). However, after updating to use the new insets, I noticed problems with some simulator configs.

 

My app is configured for landscape mode, and most configs work fine, but a few aren't rendering correctly in the simulator because of this behavior. I captured raw values to help understand what was going on.

 

If I use the iPad Mini (768x1024):

>>>>> Raw Insets (t,l,b,r): 18.75,0,0,0

If I use the borderless equivalent of iPad @ 1x (768x1024):

>>>>> Raw Insets (t,l,b,r): 9.375,0,0,0 

If I use iPhone X (1125x2436) the values appear to be correct for landscape mode:

>>>>> Raw Insets (t,l,b,r): 0,37.546669006348,17.920000076294,37.546669006348

I see that I could just change the values in the skins definitions myself, but I just want to double check to make sure I'm not overlooking something. I don't believe there is a permanent status bar or unusable area on those devices.

 

Also, the config for the iPads looks different than what I'm seeing in iPhone X, so I'm thinking some of the simulator configs may have been overlooked when this feature was introduced? In particular, some just seem to use safeLandscapeScreenInsetStatusBar whereas the new ones for iPhone X seem to be more complete (as I was expecting to see: safeLandscapeScreenInsetTop, etc).



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,147 posts
  • Corona SDK

Can you create a simple demo app that has a main.lua, config.lua, build.setting and the assets and drop them in a .zip file and share a link to it with us? We need to run it and see what you're seeing. Some screenshots of what is working and what isn't working would be very helpful too.

 

I see you filed a bug report on this. We are going to need the above for that report as well. But lets conduct the discussion here since we may want to share code and code formatting is much better here than in email.

 

Rob



[TOPIC: post.html]
#3

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 1,943 posts
  • Corona SDK

Yeah iPad safe areas are wrong you can safely ignore them in test - it will work fine on device.

 

Annoying but hey!



[TOPIC: post.html]
#4

RayCardillo

[GLOBAL: userInfoPane.html]
RayCardillo
  • Observer

  • 19 posts
  • Corona SDK

Can you create a simple demo app that has a main.lua, config.lua, build.setting and the assets and drop them in a .zip file and share a link to it with us? We need to run it and see what you're seeing. Some screenshots of what is working and what isn't working would be very helpful too.

 

I see you filed a bug report on this. We are going to need the above for that report as well. But lets conduct the discussion here since we may want to share code and code formatting is much better here than in email.

 

Rob

 

Actually, I was working on it, and in doing so, realized what the problem is. Basically, it looks like the iOS status bar property is not being honored (UIStatusBarHidden = true). If I set it directly then the inset values are as expected:

display.setStatusBar( display.HiddenStatusBar )

So all that I said previously was skewed by this... and it all makes sense now in light of this. The actual "bug" was just that the "UIStatusBarHidden = true" is not working (maybe just in simulator) and I hadn't even noticed that.

 

The quick workaround is to just set it directly instead, and that may actually be the better approach in the current state of the SDK. I'm upgrading an app I previously released to the latest SDK (mainly for iPhone X and such) so the safe area insets were my main focus, but I've had to resolve a few other things that had changed since as well. I guess this is one of them.



[TOPIC: post.html]
#5

RayCardillo

[GLOBAL: userInfoPane.html]
RayCardillo
  • Observer

  • 19 posts
  • Corona SDK

See code and screenshots here, but I do have my workaround now:

https://bitbucket.org/cardilloscreations/corona-bug-demos/src/master/safe-area-insets-and-status-bar/

 

Might want to make the documentation more clear on this point. It's always tough to give constructive feedback though, because now that I know the root cause, it all seems obvious.  :unsure:

 

Still might help others, so I figured it was worth sharing anyways.




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: safe area insets, insets, safe area