Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSDateFormatter *df = [[NSDateFormatter alloc] init];
- [df setDateFormat:@"HH:mm"];
- [tfTime setText:[NSString stringWithFormat:@"%@",[df stringFromDate:datePicker.date]]];
- selectedDateTime = [datePicker date];
- UILocalNotification *notification = [[UILocalNotification alloc] init];
- NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
- //[dateFormat setDateFormat:@"dd-MM-yyyy"];
- //NSDate *notificationDate = [dateFormat dateFromString:strRemindMeBefore];
- notification.fireDate = selectedDateTime;
- notification.alertBody = tvMessage.text;
- notification.timeZone = [NSTimeZone defaultTimeZone];
- notification.soundName = UILocalNotificationDefaultSoundName;
- notification.applicationIconBadgeNumber = 1;
- [[UIApplication sharedApplication] scheduleLocalNotification:notification];
- NSDate *selectedDateTime = [datePicker date];
- NSDate *roundedDate;
- NSCalendar *cal = [NSCalendar currentCalendar];
- [cal rangeOfUnit:NSMinuteCalendarUnit startDate:&roundedDate interval:NULL forDate:selectedDateTime];
- // …
- notification.fireDate = roundedDate;
- NSDateComponents *comps = [[[NSDateComponents alloc] init] autorelease];
- [comps setDay:1];
- [comps setMonth:1];
- [comps setYear:2013];
- [comps setHour:10];
- [comps setMinute:10];
- /// You can set this component as 00
- [comps setSecond:00];
- localNotif.fireDate = [[NSCalendar currentCalendar] dateFromComponents:comps];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement