UITextField border color

后端 未结 9 1487
一生所求
一生所求 2020-11-28 02:43

I have really great wish to set my own color to UITextField border. But so far I could find out how to change the border line style only.

I\'ve used background prope

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 03:09

    this question shows up pretty high on a Google search and worked for the most part! I did find that Salman Zaidi's answer was partially correct for iOS 7.

    You need to make a modification to the "reverting" code. I found that the following for reverting worked perfectly:

    textField.layer.cornerRadius = 0.0f;
    textField.layer.masksToBounds = YES;
    textField.layer.borderColor = [[UIColor blackColor] CGColor];
    textField.layer.borderWidth = 0.0f;
    

    I understand that this is most likely due to changes in iOS 7.

提交回复
热议问题