How to style UITextview to like Rounded Rect text field?

后端 未结 20 2315
深忆病人
深忆病人 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:32

    You can create a Text Field that doesn't accept any events on top of a Text View like this:

    CGRect frameRect = descriptionTextField.frame;
    frameRect.size.height = 50;
    descriptionTextField.frame = frameRect;
    descriptionTextView.frame = frameRect;
    descriptionTextField.backgroundColor = [UIColor clearColor];
    descriptionTextField.enabled = NO;
    descriptionTextView.layer.cornerRadius = 5;
    descriptionTextView.clipsToBounds = YES;
    

提交回复
热议问题