在我的应用程序的联系表单中,文本输入字段的框底部有一条白线。
let border = CALayer()
border.frame = CGRect(x: 0, y: textInput.frame.height, width: textInput.frame.width, height: 3)
border.borderColor = UIColor.white.cgColor
border.borderWidth = 3
textInput.layer.addSublayer(border)
所需的边框在 iOS10 上显示正常,但在 iOS8 上测试时却不显示。
iOS 8 是否有一些我不知道的利基市场?
最佳答案
您的 Y 点是文本输入的高度,使其为 0 或小于高度的值
let border = CALayer()
border.frame = CGRect(x: 0, y: textInput.frame.height - 3, width: textInput.frame.width, height: 3)
border.borderColor = UIColor.white.cgColor
border.borderWidth = 3
textInput.layer.addSublayer(border)
关于ios - CALayer 不显示 iOS8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46465678/