Possible Duplicate:
custom UITextField with image as a background blinking cursor issue
I have a UIImageView (the image has a pattern, gradient, and shadow in it). I have added a UITextField as a subview of this UIImageView and set the textField background to clear so that it’s seen through, the code is:
UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(10, 12, 359 , 36)];
textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.textColor = [UIColor whiteColor];
textField.placeholder = @"USERNAME";
textField.backgroundColor = [UIColor clearColor];
textField.font = [UIFont systemFontOfSize:15];
textField.delegate = self;
[username_background addSubview:textField];
The issue is that when I start editing the UITextField, I got the following layout issues:
Before editing:

When editing:


I can fix this if I change the UIColor clearColor background to some other color, but apparently I find difficulties getting the appropriate color for the background. I did try doing:
[[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bkg-username.png"]];
However, what I am getting is:

Add the UITextField as a subview on the view of the viewcontroller, and not the ‘username_background’ UIImageView. I believe this should fix your problem.