How to style UITextview to like Rounded Rect text field?

后端 未结 20 2237
深忆病人
深忆病人 2020-11-28 00:36

I am using a text view as a comment composer.

In the properties inspector I can\'t find anything like a border style property so that I can make use a rounded rect,

相关标签:
20条回答
  • 2020-11-28 01:35

    This is an old question, and I was also searched for this questions answer. luvieeres' answer is 100% correct and later Rob added some code. That is excellent, but I found a third party in another questions answer which seems very helpful to me. I was not only searched for similar look of UITextField over UITextView, I was also searched for multiline support. ChatInputSample satisfied both. Thats why I think this third party might be helpful to others. Also thanks to Timur, he mentioned this open source in here.

    0 讨论(0)
  • 2020-11-28 01:36

    In iOS7 the following matches UITextField border perfectly (to my eye at least):

    textField.layer.borderColor = [[[UIColor grayColor] colorWithAlphaComponent:0.5] CGColor];
    textField.layer.borderWidth = 0.5;
    textField.layer.cornerRadius = 5;
    textField.clipsToBounds = YES;
    

    There is no need to import anything special.

    Thanks to @uvieere and @hanumanDev whose answers go me almost there :)

    0 讨论(0)
提交回复
热议问题