ios - UIDatePicker first value set is not default to read -
i have set initial date in datepicker in application. if change value , select picks up, when selecting value without changing spinner value shows todays date.
i have been trying use [uidatepicker setdate:] method, having problems it, wont set. code 'selecting' date (action assigned button):
- (ibaction)backtomap:(id)sender { uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle:nil]; firstviewcontroller *fvc = [storyboard instantiateviewcontrollerwithidentifier:@"firstviewcontroller"]; fvc.modaltransitionstyle = uimodaltransitionstylecoververtical; datepicked = [datepicker date]; self.firstviewdata = fvc; fvc.passeddata = datepicked; // if ispickertype = 1 date , time // if ispickertype = 2 date fvc.datepicker = ispickertype; [self presentviewcontroller:fvc animated:yes completion:nil]; }
when do:
firstviewcontroller *fvc = [storyboard instantiateviewcontrollerwithidentifier:@"firstviewcontroller"];
you create new controller, has new date picker. so, date had default date.
you should using date picker in existing view controller, not creating new 1 if point @ you're trying user chosen date.
if you're creating controller set date want try date.
Comments
Post a Comment