iOS Question Only change border color

Discussion in 'iOS Questions' started by JanPRO, May 2, 2015.

  1. JanPRO

    JanPRO Well-Known Member Licensed User

    Hi,

    is there a way to only change the border color of a view? I already tried this:

    Code:
    Dim no As NativeObject = Panel1
    no.RunMethod(
    "setBorderColor:",Array(no.ColorToUIColor(Colors.Magenta)))
     
  2. klaus

    klaus Expert Licensed User

    Use simply the SetBorder(Width As Float, Color As Int, CornerRadius As Float) method.
     
  3. JanPRO

    JanPRO Well-Known Member Licensed User

    Yeaahh, I know this method.
    But I want to give users the option to change the whole app design, also the border colors. And for that I use the following loop:

    Code:
    For Each v As View In Page_Main.RootPanel.GetAllViewsRecursive
       .
       .
       .

       
    If v Is Panel Then
       
    Dim pn As Panel = v
       
    'Now I only want to change the color, and because I don't know the color witdh and the corner radius, I can't use SetBorder
       End If

      
    Next
    Edit:

    When I use this:

    Code:
    no.GetField("layer").RunMethod("setBorderColor:",no.ColorToUIColor(Array(Colors.Magenta)))
    I get the following error: Unsupported type ^{CGColor=}
     
    Last edited: May 2, 2015
  4. klaus

    klaus Expert Licensed User

    I gave you an answer to your question.
    Now it's another problem, never tried it that way.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You can use this code:
    Code:
    Private Sub Page1_Resize(Width As Int, Height As Int)
       
    Dim no As NativeObject = SegmentedControl1
       no = no.GetField(
    "layer")
       SegmentedControl1.SetBorder(no.GetField(
    "borderWidth").AsNumber, Colors.Red, _
         no.GetField(
    "cornerRadius").AsNumber)
    End Sub
     
    Alexander Stolte and JanPRO like this.
Loading...
  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