TKFill does not allow custom colors

5 posts, 0 answers
  1. Omar
    Omar avatar
    3 posts
    Member since:
    Apr 2016

    Posted 28 Apr Link to this post

    Hello, I find it weird that when I enter a UIColor created from a RGB "fill" does not accept this custom color and it chooses other color over it.
    Any explanation on this?
    Thank you!
  2. Bulent
    Admin
    Bulent avatar
    29 posts

    Posted 29 Apr Link to this post

    Hi Omar,

    Thank you for your interest in our iOS controls.

    You can apply any color to exposed fill properties, but you need to use TKSolidFill class and not TKFill, since the latest one is a base class not intended to be instanciated directly. 
    You can find an example how to set a color to the needle in our getting started article.

    I hope this helps.

    Regards,
    Bulent
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Omar
    Omar avatar
    3 posts
    Member since:
    Apr 2016

    Posted 29 Apr in reply to Bulent Link to this post

    I am so sorry I meant to say TKSolidFill.
    I am sorry for that.

    But still the problem is the same, I try this:

    needle.fill = [TKSolidFill solidFillWithColor:[UIColor colorWithRed:17 green:31 blue:78 alpha:1.0]];

    And my needle turns White instead of the dark blue I was hoping to see from this RGB color.
    I appreciate your attention. Thank you!
  5. Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 04 May Link to this post

    Hello, Omar,

    UIColor's colorWithRed:green:blue:alpha: method expects values between 0 an 1. The code snippet below shows how to create the correct color for the needle:
    needle.fill = [TKSolidFill solidFillWithColor:[UIColor colorWithRed:17/255.0 green:31/255.0 blue:78/255.0 alpha:1.0]];

    I hope this solves the issue.

    Regards,
    Adrian
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Omar
    Omar avatar
    3 posts
    Member since:
    Apr 2016

    Posted 04 May in reply to Adrian Link to this post

    I am so sorry for this mistake. Thank you very much!
Back to Top
DevCraft banner