Rounded UIView using CALayers - only some corners - How?

后端 未结 14 2227
南方客
南方客 2020-11-22 13:53

In my application - there are four buttons named as follows:

  • Top - left
  • Bottom - left
  • Top - right
  • Bottom - right

Abov

14条回答
  •  耶瑟儿~
    2020-11-22 14:16

    In iOS 11, we can now round some corners only

    let view = UIView()
    
    view.clipsToBounds = true
    view.layer.cornerRadius = 8
    view.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner]
    

提交回复
热议问题