简体   繁体   中英

I want to draw custom shape like apple shape on UIView

I am trying to make Apple kind of shape for progressHUD. I have option to use .png Image but I cant because I have to fill the apple Shape with different colour depends of percentage status.. I am using UIView to draw this shape...

  • I want suggestion how to draw apple kind of shape easily?
  • And How we can fill half colour with different colour?

I have option to use .png Image but I cant

Yes, you can. — Get hold of some apple-shaped artwork. Use it as a mask - it punches a hole in a view. Now put another view behind it, with a color. Now the apple appears to be that color, because that color is being seen through the apple-shaped hole. Now put another view behind it, with a different color, and move it up or across the right amount so as to divide what's seen through the apple into two colors.

Using that approach, it took me about 30 seconds to create this result (using your apple-shaped artwork as a .png image!):

在此处输入图片说明

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