ios - how to show the datepicker method call from different class? -


i creating custom datepicker in view controller class. need datepicker in view controller class. want create common datepicker view controller class can use , show date. how can use it. please share code.

i use code:

 actionsheet = [[uiactionsheet alloc] initwithtitle:@"date" delegate:self                                       cancelbuttontitle:nil                                  destructivebuttontitle:nil                                       otherbuttontitles:nil];     [actionsheet setbackgroundcolor:[uicolor graycolor ]];     [actionsheet setframe:cgrectmake(0, 470, 375, 200)];     datepicker = [[uidatepicker alloc] initwithframe:cgrectmake ( 0, 10, 300, 100)];     dateformatter = [[nsdateformatter alloc] init];     datepicker.datepickermode = uidatepickermodedate;     [dateformatter setdateformat:@"mm/dd/yyyy"];     [datepicker addtarget:self action:@selector(datechanged) forcontrolevents:uicontroleventvaluechanged];     [actionsheet addsubview:datepicker];     uitoolbar *toolbarpicker = [[uitoolbar alloc] init];     toolbarpicker.backgroundcolor=[uicolor graycolor];     // toolbarpicker.barstyle=uibarstyleblackopaque;     [toolbarpicker sizetofit];     nsmutablearray *itemsbar = [[nsmutablearray alloc] init];     //calls doneclicked       uibarbuttonitem *btndone = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(doneclicked)];     [itemsbar addobject:btndone];     [toolbarpicker setitems:itemsbar animated:yes];     [actionsheet addsubview:toolbarpicker];     [self.view addsubview:actionsheet]; }  -(ibaction)datechanged{         self.dateentry.text = [dateformatter stringfromdate:[datepicker date]]; }   -(ibaction)doneclicked{     [actionsheet removefromsuperview];     self.dateentry.userinteractionenabled = yes; } 

create custom class of uiview/nsobject, add logic on there & implement delegation design pattern manage it.

let me know if need anymore clarification same.


Comments