mrossen Active Member Licensed User Longtime User Mar 29, 2015 #1 How do I keep the colors for the image I use in bar button I know how to change it with: B4X: Dim b1 As BarButton b1.InitializeBitmap(LoadBitmap(File.DirAssets, "cruise.png"), "btn_cruise") b1.TintColor = Colors.RGB(127,176,0) Page1.TopLeftButtons = Array(b1) But how can I keep the original colors. If I dont use "b1.TintColor" the image went IOS blue Mogens
How do I keep the colors for the image I use in bar button I know how to change it with: B4X: Dim b1 As BarButton b1.InitializeBitmap(LoadBitmap(File.DirAssets, "cruise.png"), "btn_cruise") b1.TintColor = Colors.RGB(127,176,0) Page1.TopLeftButtons = Array(b1) But how can I keep the original colors. If I dont use "b1.TintColor" the image went IOS blue Mogens
Erel B4X founder Staff member Licensed User Longtime User Mar 30, 2015 #2 Add this sub: B4X: Sub KeepOriginalColors(bmp As Bitmap) As Bitmap Dim no As NativeObject = bmp Return no.RunMethod("imageWithRenderingMode:", Array(1)) End Sub Change your code to: B4X: b1.InitializeBitmap(KeepOriginalColors(LoadBitmap(...)), "btn_cruise") Upvote 0
Add this sub: B4X: Sub KeepOriginalColors(bmp As Bitmap) As Bitmap Dim no As NativeObject = bmp Return no.RunMethod("imageWithRenderingMode:", Array(1)) End Sub Change your code to: B4X: b1.InitializeBitmap(KeepOriginalColors(LoadBitmap(...)), "btn_cruise")