iOS Question Change button background

D

Deleted member 103

Guest
Hi,

how can I change the background button by code?
1) Background Image
2) Pressed Background Image
 
D

Deleted member 103

Guest
Do you think so?

B4X:
SetBackgroundImage(btn, bmp1, 0)
SetBackgroundImage(btn, bmp2, 1)
SetBackgroundImage(btn, bmp3, 2)

'state: 0 - normal, 1 - highlighted, 2 - disabled
Sub SetBackgroundImage(b As Button, bmp As Bitmap, state As Int)
Dim no As NativeObject = b
no.RunMethod("setBackgroundImage:forState:", Array(bmp, state))
End Sub
 
Upvote 0
D

Deleted member 103

Guest
Can I do this for a switch-View?
But the "switch-View" I have 4 states: Checked.enabled, Checked.disabled, unChecked.enabled, unChecked.disabled,
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
No, you cannot change the UISwitch images.
So the images are part of the library who allows to use this view?
Maybe we can ask to extend the library to get them changeable in Wish-list-forum?
Or maybe some kind of xml we can use to set "other images" for this view?
 
Upvote 0
Top