
How can i set a background image on UITextField. I have placed that UITextField on UIToolBar.

Code to Set a Background Image on UITextField
- (void)viewDidLoad {
[super viewDidLoad];
myTextField.borderStyle = UITextBorderStyleNone;
myTextField.background = [UIImage imageNamed:@"search.png"];
}

We can also set the uitextfield leftview or uitextfield rightView. This method is required when we wanted to add a small image on text field as a right or left view. Find the code below.. on how to set the uitextfield leftview image..
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView *myView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"search.png"]];
[myTextField setRightView:myView];
[myTextField setRightViewMode:UITextFieldViewModeAlways];
[myView release];
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.