如何使UIVIEW的特定边角半径不同?

问题描述 投票:1回答:1

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

ios uiview swift5 cornerradius xcode11.2.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?

© www.soinside.com 2019 - 2024. All rights reserved.