iOS Question How to use NativeObject borderColor to reset border color

Discussion in 'iOS Questions' started by Scott Bartgis, Sep 2, 2015.

  1. Scott Bartgis

    Scott Bartgis Member Licensed 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:

    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 ...

    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?
  2. Erel

    Erel Administrator Staff Member Licensed User

    Dim BorderUIColor As Int= NaObj.UIColorToColor(NaObj.GetField("layer").GetField("borderColor"))
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice