简体   繁体   中英

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.

很简单,您可以在图像上添加UIView,将其背景颜色设置为绿色,并将其Alpha设置为介于0和1之间的某个值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM