[英]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.