I want to draw custom shape like apple shape on UIView

前端 未结 1 1131
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 23:05

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 p

1条回答
  •  自闭症患者
    2020-12-10 23:17

    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!):

    enter image description here

    0 讨论(0)
提交回复
热议问题