i new iphone technology. i've saved problem in iphone application, when use textfield keyboard type number pad keyboard doesn't show return/done button.
how can hide number pad keyboard after entering number in textfield? have solutions that. please provide help.
you can in way:
@property (nonatomic, strong) uitextfield *textfield; - (void)viewdidload { [super viewdidload]; self.textfield = [[uitextfield alloc] initwithframe:cgrectmake(0, 0, 100, 40)]; uibarbuttonitem *doneitem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(donebuttondidpressed:)]; uibarbuttonitem *flexableitem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:null]; uitoolbar *toolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0, 0, [[uiscreen mainscreen] bounds].size.width, [[self class] toobarheight])]; [toolbar setitems:[nsarray arraywithobjects:flexableitem,doneitem, nil]]; self.textfield.inputaccessoryview = toolbar; } - (void)donebuttondidpressed:(id)sender { [self.textfield resignfirstresponder]; } + (cgfloat)toolbarheight { // method handle case height of toolbar may change in future ios. return 44.f; }
Comments
Post a Comment