custom UITextField with image as a background blinking cursor issue

后端 未结 3 502

I have a custom UITextField with a UIImage as a background. Now when I type in a text into this UITextField and the cursor is blinking I get this:

3条回答
  •  灰色年华
    2021-01-24 15:16

    Have you tried setting textField.backgroundColor = [UIColor clearColor]?

    You can use a UIImageView for the image and then add a UITextField as a subview with clear background. Just create UIImageView *imageView and UITextField *textField, either programmatically or in the IB. If you go programmatically, use [imageView addSubview:textField]; and set the frame as you like. In the IB, just drop the textField onto the imageView and align it as you like.

提交回复
热议问题