如何将UITextView的边框设置为与UITextField的边框颜色相同 [英] How to set the border of UITextView to same as border color of UITextField
本文介绍了如何将UITextView的边框设置为与UITextField的边框颜色相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
默认情况下,UITextField的边框颜色为浅灰色。
我想将我的UITextView设置为与UITextField具有相同的边框颜色。
By default UITextField has a light gray color as its border color. I want to set my UITextView to have the same border color as the UITextField.
我试过:
myTextView.layer.borderColor = UIColor.lightGrayColor().CGColor
or
myTextView.layer.borderColor = UIColor.lightTextColor().CGColor
or
myTextView.layer.borderColor = myTextField.layer.borderColor
他们还有有不同的颜色。
你能告诉我怎么看UITextView边框以匹配UITextField颜色吗?
They still have up to have different color. Can you please tell me how to see teh UITextView border to match UITextField color?
谢谢你。
推荐答案
尝试此代码。
UIColor *borderColor = [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0];
myTextView.layer.borderColor = borderColor.CGColor;
myTextView.layer.borderWidth = 1.0;
myTextView.layer.cornerRadius = 5.0;
更改borderWidth和cornerRadius值以获得与UITextField完全相同的ui。
change borderWidth and cornerRadius value to get exact ui as UITextField.
这篇关于如何将UITextView的边框设置为与UITextField的边框颜色相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文