【问题标题】:How make UIVIEW corner radius in specific side and different?如何使 UIVIEW 角半径在特定侧和不同?
【发布时间】:2020-04-16 08:16:28
【问题描述】:

我已附上图片。我想创建UIView 的圆角半径。请看图片https://i.stack.imgur.com/AkUuO.png

【问题讨论】:

    标签: ios uiview swift5 cornerradius xcode11.2.1


    【解决方案1】:

    希望这会有所帮助:

    let redBox = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
    redBox.backgroundColor = .red
    redBox.layer.cornerRadius = 25
    redBox.layer.maskedCorners = [.layerMaxXMaxYCorner]
    

    看起来在这里问了一个类似的问题:How to set cornerRadius for only top-left and top-right corner of a UIView?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-05
      • 1970-01-01
      相关资源
      最近更新 更多