iOS Question Status Bar, I need to customize color and remove bottom controls

b4xscripter

Member
Licensed User
Longtime User
Hi,

I have a question related to the status bar's color. I have this code:

B4X:
'Code module
#Region  Project Attributes 
    #ApplicationLabel: MSA2
    #Version: 0.0.4 
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #Target: iPhone, iPad
    #ATSEnabled: True
    #MinVersion: 7
'    #Entitlement: <key>aps-environment</key><string>production</string>
#End Region

#If RELEASE
   #CertificateFile: ios_distribution.cer
   #ProvisionFile: store.mobileprovision
#END IF

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
   
    Private Page1 As Page

    Private location As Button
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Dim no As NativeObject = NavControl

    no.GetField("navigationBar").RunMethod("setBarStyle:", Array(1))
    no.GetField("navigationBar").SetField("barTintColor", no.ColorToUIColor(Colors.ARGB(255,33,150,243)))
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("1")
   
    NavControl.ShowPage(Page1)
    Page1.TopRightButtons = Array( _
        CreateFABarButton(Chr(0xE0C8), "addAlert") _
        ,CreateFABarButton(Chr(0xE8B6), "find"))
    NavControl.ToolBarVisible = True
End Sub

Private Sub Page1_BarButtonClick (Tag As String)
    'toolbar events
    Log(Tag & " was clicked toolbar events")
End Sub


Private Sub BarButton_Click
    Dim b As Button = Sender
    Log(b.Tag & " was clicked!!!!!")
End Sub

Private Sub CreateFABarButton(text As String, tag As Object) As BarButton
    Dim bb As BarButton
    Dim b As Button
   
    b.InitializeCustom("BarButton", 0xFFFFFFFF, 0xFFFFFFFF)
    b.CustomLabel.Font = Font.CreateNew2("Material Icons", 24)
    b.Text = text
    b.Tag = tag
    b.SetLayoutAnimated(0, 1, 0, 0, 30, 40)
    bb.InitializeCustom(b)
    Return bb
End Sub


Private Sub Page1_Resize(Width As Int, Height As Int)
   
End Sub

Private Sub Application_Background
   
End Sub

Everythings works OK but I just need to change the status bar color and remove the bottom controls, as it is shown in the picture attached. Can anyone help me how to do that?
Many thanks!


upload_2018-5-15_12-26-52.png
 

b4xscripter

Member
Licensed User
Longtime User
Thank you, Erel!
For the second question, it is OK!
For the first one...
I read the post you've meant, I saw that it's about the code:

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

But what I want is to have the status bar in a different color, let's suppose, yellow. How to do it?

As in your first post, I put this as well:

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


upload_2018-5-15_15-40-32.png


Thank you for your help!

Best regards
 
Upvote 0
Top