Simply mask a UIView with a rectangle

前端 未结 7 1469
别跟我提以往
别跟我提以往 2020-11-30 20:10

I want to know how to simply mask the visible area of a UIView of any kind. All the answers/tutorials I\'ve read so far describe masking with an image, gradient or creating

7条回答
  •  抹茶落季
    2020-11-30 20:25

    No need any mask at all. Just put it into a wrapper view with the smaller frame, and set clipsToBounds.

    wrapper.clipsToBounds = true
    

提交回复
热议问题