iOS Question StatusBar Background transparent

F.Campanella

Member
Licensed User
Longtime User
Hi,
I've need to make Statusbar in transparent background.
I follow your instructions for various threads but the results is not good.

I've used this code:

B4X:
NavControl = Nav

   Dim no As NativeObject = App
   no.RunMethod("setStatusBarStyle:", Array(1))

   Dim no As NativeObject = NavControl
   no.GetField("navigationBar").RunMethod("setBarStyle:", Array(1))

   Page1.RootPanel.Color = Colors.Transparent

the results is displayed in the image. The status bar remain opaque with black color

Can you help me?

Img_1891.png
 

F.Campanella

Member
Licensed User
Longtime User
When an app is launched panel appears splash, I hide the statusbar ... when the app finishes loading all the information, I hide the splash panel and make visible the statusbar again (thanks Narek);)
 
Upvote 0

F.Campanella

Member
Licensed User
Longtime User
Hi Alberto, this is very simple...

Put this code in the Project attributes region

B4X:
#PlistExtra: <key>UIViewControllerBasedStatusBarAppearance</key><false/>

At begin of the Application_Start put the following code:

B4X:
...
...
...
Private Sub Application_Start (Nav As NavigationController)

NavControl = Nav
   NavControl.NavigationBarVisible = False

Dim no As NativeObject = App
     no.RunMethod("setStatusBarStyle:", Array(1))
 
   Dim no As NativeObject = NavControl
     no.GetField("navigationBar").RunMethod("setBarStyle:", Array(1))
 
   Dim no As NativeObject = App
   no.RunMethod("setStatusBarHidden:animated:", Array(True, False))

Is All,

tell me if you are solved!
....
 
Upvote 0

F.Campanella

Member
Licensed User
Longtime User
This is the code that I used for show my work-example that I posted here:

B4X:
Private Sub Application_Start (Nav As NavigationController)

#region Prime Inizializzazioni

   GPS.Initialize("GPS")

   LoadConf

   CaricaCitta

   NavControl = Nav
  
   Dim no As NativeObject = App
     no.RunMethod("setStatusBarStyle:", Array(1))
  
   Dim no As NativeObject = NavControl
     no.GetField("navigationBar").RunMethod("setBarStyle:", Array(1))
  
   Dim no As NativeObject = App
   no.RunMethod("setStatusBarHidden:animated:", Array(True, False))
  
   Page1.Initialize("Page1")
   Page1.RootPanel.Color = Colors.Transparent
   PageActOrarie.Initialize("PageActOrarie")
   PageActOrarie.RootPanel.Color = Colors.RGB(0,51,102) ' POI FAREMO IL COLORE GRADIENTATO UGUALE A QUELLO DELLA VERSIONE ANDROID
   PageActAltro.Initialize("PageActAltro")
   PageActAltro.RootPanel.Color = Colors.RGB(0,51,102)
   PageActConf.Initialize("PageActConf")
   PageActConf.RootPanel.Color = Colors.RGB(0,51,102)
   ClassActOrarie.Initialize(Nav)
   ClassActAltro.Initialize(Nav)
   ClassActConf.Initialize(Nav)
  
   BManager.Initialize
  
#end region

#region Immagine di Sfondo
  
   igvSfondo.Initialize("IV")
   igvSfondo.Bitmap = LoadBitmap(File.DirAssets, "sf_sereno1.jpg")
   igvSfondo.ContentMode = igvSfondo.MODE_TOPLEFT    
   Page1.RootPanel.AddView(igvSfondo, 0,0,100%x, 100%y)

#end region

...
...
...
...

This code worked for me...

P.S. The background image igvSfondo is the first View that I load in the RootPanel for the page.
 
Upvote 0

narek adonts

Well-Known Member
Licensed User
Longtime User
Upvote 0
Top