1

我附上了图片。我想创建UIView. 请看图片https://i.stack.imgur.com/AkUuO.png

4

1 回答 1

0

希望这可以帮助:

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?

于 2020-04-16T08:51:34.030 回答