0

How can I add an image to a textfield? I saw it in a few apps, but can't get around it. Also based on the location of the curser, the imageView will be initialized (add image to next line). Thanks.

skaffman
  • 398,947
  • 96
  • 818
  • 769
bakus
  • 1

2 Answers2

0

If you really mean insert an image into the text box of the textfield I don't believe this is possible. What are you trying to accomplish? There are probably more appropriate ways of doing it.

ennuikiller
  • 46,381
  • 14
  • 112
  • 137
-1

Yes We can insert imageview into textfield with the following code.

 UIImageView *myView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"text_line.png"]];
 myView.center = CGPointMake(5, 27);                     
 [letterField insertSubview:myView atIndex:0];// mgViewTitleBackGround is image
 [myView release];

Go through this code.

Juan Mellado
  • 14,973
  • 5
  • 47
  • 54
  • Doesn't position the view according to the location of the cursor, so I don't think this actually answers the question. – Smilin Brian Oct 26 '12 at 21:53