Puzzling status bar behavior

I have this line of code at the top of my main.lua:

[lua]display.setStatusBar(display.DefaultStatusBar)[/lua]

With that line of code in the main.lua file, I  do not see the status bar on the simulator for the various iPhones or the Android (but I believe the status bar never appears in the simulator for Android), but when I build and install onto Android devices, I _ do _ see the status bar upon app load. When I build and install onto an iPhone 4s, I _ do not _ see the status bar. Hhmmmm…

If I comment out that line of code, now suddenly I _ do _ see the status bar on the simulator for the various iPhones. When I build and install on devices with that line of code commented out, the status bar _ does not _ show on either the iPhone 4s or Android devices.

Miscellaneous info:

  • results are the same on both the Mac and Windows simulators

  • both Windows and Mac are running Daily Build 2883

  • Android 9 tablet is running 6.0.1

  • Galaxy Nexus phone is running 4.2.2

  • Nexus 6 phone is running 6.0.1

  • iPhone 4s is running iOS 9.3.2

Is this normal behavior? If so, how do I get the status bar to show on the iDevices?

Thank you,

Ed

Did you set the build settings for iOS devices accordingly to the gotchas in the docs?

https://docs.coronalabs.com/api/library/display/setStatusBar.html

There is a sample app that exercises the status bar. You could try building it and installing it to see if it’s behavior is matching what you’re seeing.

Rob

@torbenratzlaff: Yes, I forgot to mention that I had tried both with that set to true and false. Thank you!

I ran the demo code and found that of the 4 modes, only display.TranslucentStatusBar allowed the simulator to show the status bar. This makes me wonder, what is the expected default behavior if display.setStatusBar() is not included in the code and the plist entry UIStatusBarHidden is not specified?

Here is a list of each of the modes for display.setStatusBar(), what I expected each to do, and what it actually did (as tested on the demo app included with Corona):

display.HiddenStatusBar : Expected: hide the status bar so that when the Corona app is launched, you do not see the status bar. Actual: performed as expected.

display.DefaultStatusBar : Expected: show the status bar with the background color of the status bar matching the background color of the app. Actual: hid the status bar, same as display.HiddenStatusBar.

display.TranslucentStatusBar : Expected: show the status bar, but not sure how this would be different than the previous option display.DefaultStatusBar. Actual: performed as expected, the status bar is now shown!

display.DarkStatusBar : Expected: show the status bar and force a dark background. Actual: hid the status bar.

Several modes appear to do the same thing. Is this the expected behavior?

Thank you!

Ed

Can I suggest an alteration to the sample app? If I remember correctly, it’s on a dark background. So you might not be able to see the status bar in some cases even though it’s there. Try making a solid color background like green so you can see both light and dark colors against it and re-run your tests.

The choices are really legacy from pre-iOS 8 days where there were solid status bars and you could have a light an dark version and a translucent version. I believe all status bars in iOS 8 and 9 are translucent by default and there are light and dark versions.

If after doing the green background test, you don’t feel it’s behaving the way you expect, we can get a bug report filed to have it looked at.  That said, who know’s what Apple is going to do when they drop iOS 10 on us in a couple of weeks at WWDC.

Rob,

Per your suggestion I set the default to green and voila, text!

[lua]

– Set default screen background color to green

display.setDefault( “background”, 0, 0.42, 0.03 )[/lua]

Turns out that display.DefaultStatusBar and display.DarkStatusBar set the text black while display.TranslucentStatusBar sets the text white, although I can’t see a difference between Default and Dark. My confusion on the issue comes down to which item was being transformed - the background color vs the text. Turns out the display.setStatusBar() operates on the text color of the text in the status bar, not the background color as I assumed.

Anyway, problem solved!!!

Thank you, Rob!

Ed

Did you set the build settings for iOS devices accordingly to the gotchas in the docs?

https://docs.coronalabs.com/api/library/display/setStatusBar.html

There is a sample app that exercises the status bar. You could try building it and installing it to see if it’s behavior is matching what you’re seeing.

Rob

@torbenratzlaff: Yes, I forgot to mention that I had tried both with that set to true and false. Thank you!

I ran the demo code and found that of the 4 modes, only display.TranslucentStatusBar allowed the simulator to show the status bar. This makes me wonder, what is the expected default behavior if display.setStatusBar() is not included in the code and the plist entry UIStatusBarHidden is not specified?

Here is a list of each of the modes for display.setStatusBar(), what I expected each to do, and what it actually did (as tested on the demo app included with Corona):

display.HiddenStatusBar : Expected: hide the status bar so that when the Corona app is launched, you do not see the status bar. Actual: performed as expected.

display.DefaultStatusBar : Expected: show the status bar with the background color of the status bar matching the background color of the app. Actual: hid the status bar, same as display.HiddenStatusBar.

display.TranslucentStatusBar : Expected: show the status bar, but not sure how this would be different than the previous option display.DefaultStatusBar. Actual: performed as expected, the status bar is now shown!

display.DarkStatusBar : Expected: show the status bar and force a dark background. Actual: hid the status bar.

Several modes appear to do the same thing. Is this the expected behavior?

Thank you!

Ed

Can I suggest an alteration to the sample app? If I remember correctly, it’s on a dark background. So you might not be able to see the status bar in some cases even though it’s there. Try making a solid color background like green so you can see both light and dark colors against it and re-run your tests.

The choices are really legacy from pre-iOS 8 days where there were solid status bars and you could have a light an dark version and a translucent version. I believe all status bars in iOS 8 and 9 are translucent by default and there are light and dark versions.

If after doing the green background test, you don’t feel it’s behaving the way you expect, we can get a bug report filed to have it looked at.  That said, who know’s what Apple is going to do when they drop iOS 10 on us in a couple of weeks at WWDC.

Rob,

Per your suggestion I set the default to green and voila, text!

[lua]

– Set default screen background color to green

display.setDefault( “background”, 0, 0.42, 0.03 )[/lua]

Turns out that display.DefaultStatusBar and display.DarkStatusBar set the text black while display.TranslucentStatusBar sets the text white, although I can’t see a difference between Default and Dark. My confusion on the issue comes down to which item was being transformed - the background color vs the text. Turns out the display.setStatusBar() operates on the text color of the text in the status bar, not the background color as I assumed.

Anyway, problem solved!!!

Thank you, Rob!

Ed