ios - UIDatePicker with UIToolbar -


i'm trying implement uitoolbar on uidatepicker dismiss when touching "done" button. when tap on button, datepicker scrolling , action button doesn't work.

here code :

datepicker = [[uidatepicker alloc] initwithframe:cgrectzero]; [datepicker setdatepickermode:uidatepickermodedate]; [datepicker addtarget:self action:@selector(changedate:) forcontrolevents:uicontroleventvaluechanged];  uitoolbar *toolbar= [[uitoolbar alloc] initwithframe:cgrectmake(0,0,self.view.frame.size.width,44)]; toolbar.barstyle = uibarstyledefault; uibarbuttonitem *flexiblespaceleft = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil]; uibarbuttonitem* donebutton = [[uibarbuttonitem alloc] initwithtitle:@"done" style:uibarbuttonitemstyledone target:self action:@selector(dismiss)];  [toolbar setitems:[nsarray arraywithobjects:flexiblespaceleft, donebutton, nil]]; [datepicker addsubview:toolbar]; 

my datepicker :

uidatepicker

thank help.

if use uitextfield set

textfield.inputaccessoryview = toolbar; textfield.inputview = datepicker; 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -