簡體   English   中英

CALayer未顯示iOS8

[英]CALayer not showing 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的一些利基嗎?

您的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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM