【问题标题】:tableView Scroll then progressView corner radius change automaticallytableView 滚动然后 progressView 角半径自动更改
【发布时间】:2019-07-30 19:31:45
【问题描述】:

我在表格视图中添加进度视图。我滚动 uitableView 然后跟踪角半径不显示如何设置他的角半径。 即使我也添加了图层角半径

 progressBar.layer.sublayers![1].cornerRadius = 8
 progressBar.subviews[1].clipsToBounds = true

【问题讨论】:

    标签: ios swift tableview progress-bar scrollview


    【解决方案1】:

    请使用下面的 swift 5.0 扩展来设置拐角半径

    extension UIView{
        func setCorner(withRadius:Int, borderWidth:Int = 0, color: UIColor = .clear){
            self.layer.cornerRadius = radius
            self.layer.borderColor = color
            self.layer.borderWidth = borderWidth
            self.clipsToBounds = true
        }
    }
    

    并将其用作

    progressBar.setCorner(withRadius: 8)//what ever radius you want to set.
    

    【讨论】:

      猜你喜欢
      • 2016-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-25
      相关资源
      最近更新 更多