iOS Question Transparent for navigation bar

Keith Yong

Active Member
Licensed User
Longtime User
Is that possible to set transparent or alpha for navigation bar?

 

Attachments

  • 6BYIK.png
    76.6 KB · Views: 1,281

JanPRO

Well-Known Member
Licensed User
Longtime User
Hi,
B4X:
Sub SetNavigationBarTransparent
    Dim NaObj As NativeObject = NavControl
    NaObj.GetField("view").RunMethod("setBackgroundColor:",Array(NaObj.ColorToUIColor(Colors.Transparent)))
  
    NaObj = NaObj.GetField("navigationBar")
    NaObj.RunMethod("setTranslucent:",Array(True))
  
    Dim NaObj2 As NativeObject
    NaObj2 = NaObj2.Initialize("UIImage").RunMethod("new",Array())
  
    NaObj.RunMethod("setBackgroundImage:forBarMetrics:",Array(NaObj2,0))
    NaObj.RunMethod("setShadowImage:",Array(NaObj2))
    NaObj.RunMethod("setBackgroundColor:",Array(NaObj.ColorToUIColor(Colors.Transparent)))
End Sub

Jan
 
Last edited:
Upvote 0

JanPRO

Well-Known Member
Licensed User
Longtime User
Or
B4X:
Sub SetNavigationBarAlpha(Alpha As Float,Color As Int)
    Dim NaObj As NativeObject = NavControl
    NaObj = NaObj.GetField("navigationBar")
 
    NaObj.RunMethod("setBarTintColor:",Array(NaObj.ColorToUIColor(Color)))
    NaObj.RunMethod("setTranslucent:",Array(True))
    NaObj.RunMethod("setAlpha:",Array(Alpha))
End Sub

But in the picture I think, a blur effect was set to the navigationbar ...
 
Last edited:
Upvote 0

Keith Yong

Active Member
Licensed User
Longtime User


Thanks Jan! it works perfect for me~
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…