iOS Question Show status bar after hiding it

JackKirk

Well-Known Member
Licensed User
Longtime User
This thread:
https://www.b4x.com/android/forum/threads/full-screen-apps.47866/#post-650730

shows how to hide the status bar.

But how do you show it again?
B4X:
Dim no As NativeObject = app
no.RunMethod("setStatusBarHidden:animated:", Array(False, False))
doesn't seem to work - or it may be putting up a blank status bar.

I've googled without success.

BTW it appears that setStatusBarHidden:animated is well and truly deprecated so is a more up to date means possible?

Thanks in advance...
 

JackKirk

Well-Known Member
Licensed User
Longtime User
Check the options with NavControlExtra from iUI8.
Not sure I understand this.

I wrapped the "hide status bar" stuff as follows:
B4X:
    Private wrk_navxtra As NavControlExtra
    wrk_navxtra.Initialize(Main.NavControl)
    Log("B4 hiding")
    Log("HidesBarOnSwipe                " & wrk_navxtra.HidesBarOnSwipe)
    Log("HidesBarsOnTap                 " & wrk_navxtra.HidesBarsOnTap)
    Log("HidesBarsWhenKeyboardAppears   " & wrk_navxtra.HidesBarsWhenKeyboardAppears)
    Log("HidesBarsWhenVerticallyCompact " & wrk_navxtra.HidesBarsWhenVerticallyCompact)

    'Hide status bar, see:
    'https://www.b4x.com/android/forum/threads/full-screen-apps.47866/#content
    Private wrk_no As NativeObject = Main.App
    wrk_no.RunMethod("setStatusBarHidden:animated:", Array(True, False))
    
    Log("After hiding")
    Log("HidesBarOnSwipe                " & wrk_navxtra.HidesBarOnSwipe)
    Log("HidesBarsOnTap                 " & wrk_navxtra.HidesBarsOnTap)
    Log("HidesBarsWhenKeyboardAppears   " & wrk_navxtra.HidesBarsWhenKeyboardAppears)
    Log("HidesBarsWhenVerticallyCompact " & wrk_navxtra.HidesBarsWhenVerticallyCompact)

And wrapped the "show status bar" stuff as follows:
B4X:
    Private wrk_navxtra As NavControlExtra
    wrk_navxtra.Initialize(Main.NavControl)
    Log("B4 showing")
    Log("HidesBarOnSwipe                " & wrk_navxtra.HidesBarOnSwipe)
    Log("HidesBarsOnTap                 " & wrk_navxtra.HidesBarsOnTap)
    Log("HidesBarsWhenKeyboardAppears   " & wrk_navxtra.HidesBarsWhenKeyboardAppears)
    Log("HidesBarsWhenVerticallyCompact " & wrk_navxtra.HidesBarsWhenVerticallyCompact)

    'Show status bar, see:
    'https://www.b4x.com/android/forum/threads/full-screen-apps.47866/#content
    Private wrk_no As NativeObject = Main.App
    wrk_no.RunMethod("setStatusBarHidden:animated:", Array(False, False))

    Log("After showing")
    Log("HidesBarOnSwipe                " & wrk_navxtra.HidesBarOnSwipe)
    Log("HidesBarsOnTap                 " & wrk_navxtra.HidesBarsOnTap)
    Log("HidesBarsWhenKeyboardAppears   " & wrk_navxtra.HidesBarsWhenKeyboardAppears)
    Log("HidesBarsWhenVerticallyCompact " & wrk_navxtra.HidesBarsWhenVerticallyCompact)

The log was:
B4 hiding
HidesBarOnSwipe false
HidesBarsOnTap false
HidesBarsWhenKeyboardAppears false
HidesBarsWhenVerticallyCompact false
After hiding
HidesBarOnSwipe false
HidesBarsOnTap false
HidesBarsWhenKeyboardAppears false
HidesBarsWhenVerticallyCompact false
B4 showing
HidesBarOnSwipe false
HidesBarsOnTap false
HidesBarsWhenKeyboardAppears false
HidesBarsWhenVerticallyCompact false
After showing
HidesBarOnSwipe false
HidesBarsOnTap false
HidesBarsWhenKeyboardAppears false
HidesBarsWhenVerticallyCompact false

Is this what you are suggesting?
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
Update:

I am trying to do the following when showing webpages (via WKWebView) and videos (via VideoPlayer):

turn status bar off
do WKWebView or VideoPlayer stuff
turn status bar on

the code for these is very similar.

I have just realised that when I do the WKWebView stuff it works fine - it is only when I do the Videoplayer stuff that the status bar does not return.

So the problem is somehow associated with Videoplayer.
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
Where are you calling no.RunMethod("setStatusBarHidden:animated:", Array(False, False))? Have you tried to remove the video player before calling it?
I was doing this:
B4X:
        'Clean up
    Videoplayer_page.RootPanel.RemoveAllViews

    'Show status bar, see:
    'https://www.b4x.com/android/forum/threads/full-screen-apps.47866/#content
    Private wrk_no As NativeObject = Main.App
    wrk_no.RunMethod("setStatusBarHidden:animated:", Array(False, False))

    'Return to previous page
    Main.NavControl.RemoveCurrentPage
I changed it to:
B4X:
        'Show status bar, see:
    'https://www.b4x.com/android/forum/threads/full-screen-apps.47866/#content
    Private wrk_no As NativeObject = Main.App
    wrk_no.RunMethod("setStatusBarHidden:animated:", Array(False, False))

    'Clean up
    Videoplayer_page.RootPanel.RemoveAllViews

    'Return to previous page
    Main.NavControl.RemoveCurrentPage
but it made no difference - status bar still goes AWOL.
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
Attached zip shows the problem my end:

After loading, note status bar is showing.

Tap screen - a video plays - note status bar is gone (as intended).

Either wait for video to end or tap <Back in top left hand corner.

You are returned to main page but status bar is not visible (as not intended).
 

Attachments

  • StatusBarBug.zip
    7.2 KB · Views: 212
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
I've added this code to the main page and it seems to work properly:
Sorry - didn't work for me in either the StatusBarBug (post #8) or my full blown app.

I bracketed your suggested code with simple log statements and it is definitely being executed.

I'm using B4i 5.3
 
Last edited:
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
I tried Sleep(500) and Sleep(5000) - neither worked.

For the record I am on an iPhone A1429 (iPhone 5) running iOS 10.3.3

Did the sample in post #8 exhibit the problem on iPhone X? (i.e. as sent, before you made any mods)
 
Upvote 0
Top