iphone - Why does the font of my UITextField change when editing? -
my uitextfield's font gets lighter when being edited, , bolder whenever editing finishes. these images should illustrate problem:
can explain why is, , how stop it?
this code i've got - first uitextfield subclass (which there add margins):
@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 it's added in 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]; }
checked code.... , there 1 word wtf....!
don't know what's wrong there solution , it's
self.nametextfield.font = [uifont fontwithname:@"courier new" size:21];
change font name. work.. cheers :)
way found bug or may not that's why apple has added "courier new".
don't know...
Comments
Post a Comment