这是文本字段的理想设计:
这是我设计的:
我是否必须导入一些库或安装一些 pod?有程序化的方法吗?
最佳答案
下面是代码。
@IBOutlet weak var fullName: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
let bottomBorder = CALayer()
bottomBorder.frame = CGRect(x: 0, y: fullName.frame.size.height-1, width: fullName.frame.size.width, height: 1.0)
bottomBorder.backgroundColor = UIColor.white.cgColor
fullName.layer.addSublayer(bottomBorder)
}
输出:
关于ios - 如何将我的文本字段设为线而不是框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41442506/