ilan Expert Licensed User Longtime User May 26, 2015 #1 how can i change the button backcolor? Code: Sub SetBackgroundImage(b As Button, cr1 As String , state As Int) Dim no As NativeObject = b no.RunMethod("setBackgroundColor:forState:", Array(cr1, state)) End Sub this doesnot work
how can i change the button backcolor? Code: Sub SetBackgroundImage(b As Button, cr1 As String , state As Int) Dim no As NativeObject = b no.RunMethod("setBackgroundColor:forState:", Array(cr1, state)) End Sub this doesnot work
narek adonts Well-Known Member Licensed User Longtime User May 26, 2015 #2 Just use button.color=colors.blue for exemple If you need to track the touchdown and touchup events you can use my GestureRecognizer class Upvote 0
Just use button.color=colors.blue for exemple If you need to track the touchdown and touchup events you can use my GestureRecognizer class
ilan Expert Licensed User Longtime User May 26, 2015 #3 narek adonts said: Just use button.color=colors.blue for exemple If you need to track the touchdown and touchup events you can use my GestureRecognizer class Click to expand... should be done easier ... only set 2 states with different backcolors... Upvote 0
narek adonts said: Just use button.color=colors.blue for exemple If you need to track the touchdown and touchup events you can use my GestureRecognizer class Click to expand... should be done easier ... only set 2 states with different backcolors...
narek adonts Well-Known Member Licensed User Longtime User May 26, 2015 #4 Ok. Why clr is a string? i think it should be a UIColor. You can use no.colortoUIColor Upvote 0
narek adonts Well-Known Member Licensed User Longtime User May 26, 2015 #5 try this - NOT TESTED Code: Sub SetBackgroundImage(b As Button, cr1 As Int , state As Int) Dim no As NativeObject = b no.RunMethod("setBackgroundColor:forState:", Array(no.ColorToUIColor(cr1), state)) End Sub Upvote 0
try this - NOT TESTED Code: Sub SetBackgroundImage(b As Button, cr1 As Int , state As Int) Dim no As NativeObject = b no.RunMethod("setBackgroundColor:forState:", Array(no.ColorToUIColor(cr1), state)) End Sub
ilan Expert Licensed User Longtime User May 26, 2015 #6 Method not found: setBackgroundColor:forState:, target: <UIButton: 0x1569ab40; frame = (50 323.478; 190 62.6087); opaque = NO; gestureRecognizers = <NSArray: 0x1569bce0>; layer = <CALayer: 0x1567a6e0>> Click to expand... i guess their is no background color with state in ios but title color works Code: Sub SetTitleColor(b As Button, cr1 As Int , state As Int) Dim no As NativeObject = b no.RunMethod("setTitleColor:forState:", Array(no.ColorToUIColor(cr1), state)) End Sub use: SetTitleColor(startbtn,Colors.Green,1) thanks anyway EDIT: i solved it by adding a bitmap to state 1 with the background color i wanted so like this there is only for state 1 a background image and state 0 is the backcolor i choose, thanx Last edited: May 26, 2015 Upvote 0
Method not found: setBackgroundColor:forState:, target: <UIButton: 0x1569ab40; frame = (50 323.478; 190 62.6087); opaque = NO; gestureRecognizers = <NSArray: 0x1569bce0>; layer = <CALayer: 0x1567a6e0>> Click to expand... i guess their is no background color with state in ios but title color works Code: Sub SetTitleColor(b As Button, cr1 As Int , state As Int) Dim no As NativeObject = b no.RunMethod("setTitleColor:forState:", Array(no.ColorToUIColor(cr1), state)) End Sub use: SetTitleColor(startbtn,Colors.Green,1) thanks anyway EDIT: i solved it by adding a bitmap to state 1 with the background color i wanted so like this there is only for state 1 a background image and state 0 is the backcolor i choose, thanx