omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    How do you set a color with objc?

    Pythonista
    2
    3
    3040
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cook
      cook last edited by

      I want to set a color in objc... Not sure what it needs.

      I'm working on UISlider...
      This doesn't work:

      setThumbTintColor_(ui.parse_color('#566565'))

      @omz @jonb

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        when dealing with objc, you usually need to look up the reference page from Apple to see what the arguments types are.

        In this case, it takes a UIColor. Objc_util comes with UIColor already aliased for you. Poke around the UIColor.... autocomplete in the console, and you may find some useful ones.

        S.thumbTintColor=UIColor.colorWithRed_green_blue_alpha_(0.4,.2,.01,1)
        or, for example
        S.thumbTintColor=UIColor.colorWithHexString_('ff1aa0')

        UIVolor also has a bunch of "named colors" like UIColor.redColor(), etc.

        1 Reply Last reply Reply Quote 0
        • cook
          cook last edited by

          @JonB thank you! Good to know!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors