繁体   English   中英

Swift Left Side Only带有边框的圆形按钮

[英]Swift Left Side only rounded button with border

我如何获得这种下拉菜单?

我正在使用按钮。 可以弄圆角,但是左边的边框是圆的,右边的边框是直的

您可以按照以下步骤获得所需的下拉菜单布局。

1.使用UITableView进行下拉。

2.创建一个UITableViewCell。

3.将圆角添加到一侧的UIView中。

let rectShape = CAShapeLayer()
rectShape.bounds = self.roundedView.frame
rectShape.position = self.roundedView.center
rectShape.path = UIBezierPath(roundedRect: self.roundedView.bounds, byRoundingCorners: [.bottomLeft , .topLeft], cornerRadii: CGSize(width: 20, height: 20)).cgPath

 self.roundedView.layer.backgroundColor = UIColor.purple.cgColor
//Here I'm masking the textView's layer with rectShape layer
 self.roundedView.layer.mask = rectShape

4.将边框添加到roundedView。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM