0

i have a UITextfield with background image(TextBox.png) in IBoutlet...every thing working fine but the problem is cursor blinking inside,cursor is not visible up to two characters,can any one help me to solve this


so i tried to solve this in the way that

i have added a image View with TextBox.png image and placed text field on the top of image view

but textfield going behind the image view (Place holder is not visible)...
can i add textfield as subView to imageView in IBOutlet,i know how to add programatically

Can any one help me to solve this problem

DShah
  • 9,768
  • 11
  • 71
  • 127
Bad Boy
  • 628
  • 2
  • 5
  • 23

2 Answers2

0

You can have a UIImageView containing the background UIImage and the UITextView as siblings, then in Interface Builder move the text view to overlap the image view (or add them both to the same parent view if doing it programmatically). You also have to make sure the text view is not opaque and give it a 0% opacity background (There is a predefined clearColor you can use).

It's a pretty cheap trick, but it's the only way to really give yourself full control over the appearance.

Sneakyness
  • 5,305
  • 4
  • 33
  • 39
0

I wrote a UITextField subclass with custom background and padding in this answer: Indent the text in a UITextField There are no cursor issues.

Community
  • 1
  • 1
Jano
  • 62,815
  • 21
  • 164
  • 192