iOS Question Can I have this method B4i

jahswant

Well-Known Member
Licensed User
Longtime User
B4X:
Sub SetColorStateList(Btn As Label,Pressed As Int,Enabled As Int)
    Dim States(2,1) As Int
    States(0,0) = 16842919    'Pressed
    States(1,0) = 16842910    'Enabled
    Dim CSL As JavaObject
    CSL.InitializeNewInstance("android.content.res.ColorStateList",Array(States,Array As Int(Pressed, Enabled)))
    Dim B1 As JavaObject = Btn
    B1.RunMethod("setTextColor",Array As Object(CSL))
End Sub
 

jahswant

Well-Known Member
Licensed User
Longtime User
I see this will only work for UIButton not Label

Expected: UIButton, object type: UILabel

Method not found: setTitleColor:forState:, target: <UILabel: 0x7fd0af74ca70; frame = (7 160; 150 36); text = 'VIEW'; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60000077d710>; animations = { bounds.origin=<CASpringAnimation: 0x600000941320>; bounds.size=<CASpringAnimation: 0x600000941340>; position=<CASpringAnimation: 0x6000009413a0>; }; layer = <_UILabelLayer: 0x600002a1c7d0>>
 
Upvote 0
Top