2017-09-28 93 views
0

在我的應用的聯繫表單中,文本輸入字段在框的底部有一條白線。CALayer未顯示iOS8

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?

回答

2

你Ÿ點是TextInput的高度使它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) 
+0

是啊!謝謝Raj。 – ochhii