【发布时间】:2015-09-22 19:45:22
【问题描述】:
如何仅设置文本视图的左下角、右下角和左上角的角半径?
let rectShape = CAShapeLayer()
rectShape.backgroundColor = UIColor.redColor().CGColor
rectShape.bounds = messages.frame
rectShape.position = messages.center
rectShape.path = UIBezierPath(roundedRect: messages.bounds, byRoundingCorners: .BottomLeft | .TopRight, cornerRadii: CGSize(width: 20, height: 20)).CGPath
messages.layer.addSublayer(rectShape)
这段代码创建了两个矩形。我不知道为什么。
【问题讨论】:
-
在此代码中,您将添加 rectshape 作为消息 textView 的子层,而不是添加掩码
-
Zept,有意义吗???
标签: swift textview rounded-corners