I create a UITextField programmatically and put it in a UIView. The font size is 15.0f (system font). But the replacement object is not in the text view. Does anyone know how to solve this?
I found some SO links for blurry text, etc. and tried to set a text box frame with integer values, but that doesn't matter.
UITextField *txtField = [[UITextField alloc] initWithFrame:CGRectMake(5.0f, 6.0f, 278.0f, 32.0f)]; [txtField setPlaceholder:@"My placeholder"]; [txtField setFont:[UIFont systemFontOfSize:15.0]]; [txtField setBorderStyle:UITextBorderStyleRoundedRect]; [txtField setAutocorrectionType:UITextAutocorrectionTypeNo]; [txtField setAutocapitalizationType:UITextAutocapitalizationTypeNone]; [txtField setKeyboardType:UIKeyboardTypeEmailAddress]; [txtField setReturnKeyType:UIReturnKeyDone]; [txtField setClearButtonMode:UITextFieldViewModeWhileEditing];
Thanks for any help
Note. I mean, the text is not centered vertically in the text box (it is a little closer to the top). Therefore, setting text alignment is not a solution.
Adding an image of a problem for clarification - as you can see in the image, the placeholder text refers more to the vertex rather than vertically centered. 
iphone uitextfield
lostInTransit Sep 08 '10 at 7:11 2010-09-08 07:11
source share