How to set the border of UITextView to same as border color of UITextField

前端 未结 8 2039
遇见更好的自我
遇见更好的自我 2020-12-24 10:37

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.

I tried:

<         


        
8条回答
  •  爱一瞬间的悲伤
    2020-12-24 11:12

    Try this code.

    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;
    

    change borderWidth and cornerRadius value to get exact ui as UITextField.

提交回复
热议问题