【发布时间】:2015-09-15 11:06:17
【问题描述】:
我想只显示底部边框并隐藏其他边。
输出我看到:如您所见,我也看到了顶部、左侧和右侧边框,它们是黑色的,我想删除它们。只需要底部白色粗2.0边框。
我正在使用的代码 (source):
var border = CALayer()
var width = CGFloat(2.0)
border.borderColor = UIColor.whiteColor().CGColor
border.frame = CGRect(x: 0, y: tv_username.frame.size.height - width, width: tv_username.frame.size.width, height: tv_username.frame.size.height)
border.borderWidth = width
tv_username.backgroundColor = UIColor.clearColor()
tv_username.layer.addSublayer(border)
tv_username.layer.masksToBounds = true
tv_username.textColor = UIColor.whiteColor()
【问题讨论】:
标签: ios xcode swift uitextfield