iOS Question How to use NativeObject borderColor to reset border color

Scott Bartgis

Member
Licensed User
Longtime User
Using the DraggableView class that was attached to some other post, I am adding an Undrag method to the class. I like that it changes the border of the panel to red to show it is dragging, but upon "fixing" its location, I want the border to return to the original color.

I am storing the original object parameters prior to the modification. To obtain the original border params, I use NativeObject:

B4X:
Dim NaObj As NativeObject = originalPanel
Dim BorderWidth As Float = NaObj.GetField("layer").GetField("borderWidth").AsNumber
Dim BorderUIColor As Object = NaObj.GetField("layer").GetField("borderColor")
Dim BorderRadius As Int = NaObj.GetField("layer").GetField("cornerRadius").AsNumber

The BorderUIColor needs to be changed to a Color so I thought ...

B4X:
Dim BorderColor As Int = NaObj.UIColorToColor(BorderUIColor)

But that explodes with an error: -[__NSCFType getRed:green:blue:alpha:]: unrecognized selector sent to instance 0x14e62830

For now, I can workaround by setting the border to what I know is the original color, but how can I make the generic case work?
 
Top