nsdate - ios set UIDatePicker time ahead -
i grab current time
nsdate * = [[nsdate alloc] init]; nscalendar *cal = [nscalendar currentcalendar]; nsdatecomponents * comps = [cal components:nsyearcalendarunit|nsmonthcalendarunit|nsdaycalendarunit fromdate:now];
and can set datepicker values desire
nsdate * date = [cal datefromcomponents:comps]; [self.off setdate:date animated:true];
but how add a, say, 5 minutes "now"?
try
nsdate *date = [[nsdate date] datebyaddingtimeinterval:5*60];
Comments
Post a Comment