我有一个UITextView,我想改变它的边框颜色和圆角。 根据{{3}},我可以以编程方式进行。
CALayer *imageLayer = textView.layer;
[imageLayer setCornerRadius:10];
[imageLayer setBorderWidth:1];
imageLayer.borderColor=[[UIColor lightGrayColor] CGColor];
我不喜欢这种方式所以我创建了一个名为DetailTextView的UITextView子类。 我应该如何改变边界颜色并绕过子类内的角落?
答案 0 :(得分:1)
你可以看看这个帮助我很多的要点:https://gist.github.com/pix0r/1074843
如果像我一样使用Interface Builder实例化UITextView,您可能希望在awakeFromNib
中设置属性,而不是init
。例如:
- (void)setProperties
{
self.cornerRadius = 5.0f;
self.borderWidth = 1.0f;
self.borderColor = self.tintColor;
}