iOS: Rounded rectangle with border bleeds color

后端 未结 7 1320
悲&欢浪女
悲&欢浪女 2020-12-09 10:12

I\'m drawing round avatar pics, by just applying cornerRadius to a UIImageView\'s layer, and also adding a border via borderWith and <

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 10:22

    My UIButton needed a rounded corner radius which resulted in jagged edges. Setting borderStyle to .roundedRect fixed it.

    button.borderStyle = .roundedRect
    button.layer.cornerRadius = 4
    button.layer.borderWidth = 1
    button.layer.borderColor = .red.cgColor
    

提交回复
热议问题