I need to display a image view that is filled with violet color picture as shown below
,
but there us no UIColor color violet for this.
How can i display it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use:
to define a custom UIColor with values for red, green and blue, and set it to the background color of your ImageView:
Take a look at this question regarding adding a border to the view.
EDIT (Question clarified somewhat)
It looks like you’re trying to display an image that has a portion coloured at runtime.
To do this, create the image as a png, and leave the parts you want to be filled with the color transparent. You can then set the background color of the UIImageView to the violet approximation, and set the image property to the image you created.
Note that Violet is outside the color gamut of the RGB colour space, so you’ll need to find the RGB values of the color you want. Also note this function takes values between 0 and 1 rather than 0 and 255.