[英]Swift Left Side only rounded button with border
How can i get this kind of dropdown ? 我如何获得这种下拉菜单?
I'm using button. 我正在使用按钮。 Able to get rounded corners but border on left to be round and straight on right is a problem
可以弄圆角,但是左边的边框是圆的,右边的边框是直的
you can follow below steps to achieve the layout of Dropdown you want. 您可以按照以下步骤获得所需的下拉菜单布局。
1.Use UITableView for dropdown. 1.使用UITableView进行下拉。
2.Create a UITableViewCell. 2.创建一个UITableViewCell。
3.Add Rounded Corner to the UIView on one side. 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. Add border to roundedView. 4.将边框添加到roundedView。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.