Clipped UITextField with UITextFieldAlignmentRight
- by Typeoneerror
Got a small problem with UITextField. I have a simple UITextField and when I set the textAlignment property to "right", it gets clipped by 1-2 pixels. It looks shite so I'm hoping someone has an idea of how to remedy this. I've tried setting the frame to integers to prevent them from being on .5 pixels.
- (UITextField *)textControlForSetting:(NSDictionary *)settings
{
CGRect frame = CGRectIntegral(CGRectMake(100.0f, 0.0f, 170.0f, 44.0f));
UITextField *textField = [[[UITextField alloc] initWithFrame:frame] autorelease];
NSString *defaultValue = [settings objectForKey:kDefaultValueKey];
NSString *currentValue = [prefs objectForKey:[settings objectForKey:kSettingKey]];
textField.tag = settingsCounter;
textField.delegate = self;
textField.textAlignment = UITextAlignmentRight;
textField.font = [UIFont fontWithName:@"HelveticaNeue" size:14.0f];
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
textField.placeholder = (currentValue != nil) ? currentValue : defaultValue;
settingsCounter++;
return textField;
}