0
我加底邊框的UITextField這樣:的iOS:移動的UITextField的底部邊框下
let bottomLine = CALayer()
bottomLine.frame = CGRectMake(0.0, self.frame.height, self.frame.width, CGFloat(borderWidth))
bottomLine.backgroundColor = borderColor.CGColor
self.borderStyle = UITextBorderStyle.None
self.layer.addSublayer(bottomLine)
而且我得到這個:
我想舉邊界下來。要做到這一點,我設置邊框這種方式:
bottomLine.frame = CGRectMake(0.0, self.frame.height + 5, self.frame.width, CGFloat(borderWidth))
在這裏,我增加了5px。但它超出了文本框的框架。但我不能調整UITextField
的身高:
如果我以編程方式設置它,應用程序掛在清爽designables(我用IBDesignable
子類的UITextField
)。
看到這一次它可以幫助你http://stackoverflow.com/questions/38303520/ios-uitextfield-border-style-in -swift/38303809#38303809 –