iOS UIView subclass, draw see-through text to background

后端 未结 4 1816
灰色年华
灰色年华 2020-12-01 08:51

I want to draw text onto my subclass on UIView so that the text is cut out of the shape and the background behind the view shows through, just like in the OSX Mavericks logo

4条回答
  •  一整个雨季
    2020-12-01 09:02

    If all you want is a white view with some stuff (text images, etc) cut out, then you can just do

    yourView.layer.compositingFilter = "screenBlendMode"
    

    This will leave the white parts white and the black parts will be see-through.

提交回复
热议问题