Job_September_2020
Job_September_2020

Reputation: 880

How to set the transparency level for a color over a fixed background image in C# for iOS?

I would like to have these 2 things in my iOS game:

(A) One background image of a car as the background image of the game. This background image has the RED color. (I already know how to do this part A).

(B) Next, I want to draw a GREEN rectangle on the TOP of that background image of the car. But, I need to set some level of transparency for that GREEN rectangle so that the GREEN rectangle is 50% clear (or transparent) in order for viewers to be able to see the part of the car behind that GREEN rectangle. This transparency is what I don't know how to implement yet.

Would you please show me how to write the code for part (B) in C# for iOS ?

(I am using C# with Xamarin to write code, and unfortunately, I can't understand Objective-C or Swift.)

Thank you very much.

Upvotes: 0

Views: 432

Answers (1)

Ivan I
Ivan I

Reputation: 9990

It is simple, you add UIView over the image, set its background color to green and set its Alpha to some value between 0 and 1.

Upvotes: 1

Related Questions