objective c - iOS 6.x: Changing UITextField Font Property Dynamically Causes Cursor To Get Lost -
with ios 6.x, if ask notified uitextfieldtextdidchangenotification
, , size font in notification, cursor gets confused , draws in wrong place.
@implementation mytextfield - (id)initwithcoder:(nscoder*)coder { if (self = [super initwithcoder:coder]) { [nsnotificationcenter.defaultcenter addobserver:self selector:@selector(textfielddidchange:) name:uitextfieldtextdidchangenotification object:self]; } return self; } - (void)textfielddidchange:(nsnotification *)notification { self.font = [uifont systemfontofsize:20 - self.text.length]; } @end
this wasn't problem ios 5.x. workarounds cursor reset/redraw when happens?
try calling
[self becomefirstresponder];
in textfielddidchange, after self.font = .... don't know if help, might quick workaround.
Comments
Post a Comment