博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
·ios 圆角
阅读量:7105 次
发布时间:2019-06-28

本文共 489 字,大约阅读时间需要 1 分钟。

uiview

直接设置 view.layer.cornerRadius = 5

 

uiimageview

还需要在设置view.layer.masksToBounds = true 。uiview设置这句的话会造成不必要的离屏渲染影响性能

图片圆角不推荐使用该方法

 

 

 

推荐使用的切圆角方法

extension UIImageView{    /*     图片切圆角     */    func roundedRect(_ cornerRadius:CGFloat){        let bpath = UIBezierPath.init(roundedRect: self.bounds, cornerRadius: cornerRadius)        let layer = CAShapeLayer.init()        layer.path = bpath.cgPath        self.layer.mask = layer    }}

  

  

 

转载于:https://www.cnblogs.com/rchao/p/10729318.html

你可能感兴趣的文章