My UITextField font gets easier when it is being edited, and bolder when editing. These images should illustrate the problem:


Can someone explain why this is so and how to stop it?
This is all the code I have for it - first my subclass of UITextField (which just adds fields):
@interface RLTextField : UITextField { } @end @implementation RLTextField - (CGRect)editingRectForBounds:(CGRect)bounds { CGRect editingRect = CGRectMake(bounds.origin.x+35, bounds.origin.y-5, bounds.size.width, bounds.size.height); return editingRect; } - (CGRect)textRectForBounds:(CGRect)bounds { CGRect editingRect = CGRectMake(bounds.origin.x+35, bounds.origin.y-5, bounds.size.width, bounds.size.height); return editingRect; } @end
And then where it is actually added to my viewController:
- (void)viewDidLoad { CGRect noteTitleTextFrame = CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y+10, self.view.bounds.size.width, 44); RLTextField *textField = [[RLTextField alloc] initWithFrame:noteTitleTextFrame]; self.nameTextField = textField; [textField release]; self.nameTextField.delegate = self; self.nameTextField.borderStyle = UITextBorderStyleNone; self.nameTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom; self.nameTextField.font = [UIFont fontWithName:@"Courier" size:21]; [self.view addSubview:self.nameTextField]; }
source share