Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. NSDateFormatter *df = [[NSDateFormatter alloc] init];
  2. [df setDateFormat:@"HH:mm"];
  3.  
  4. [tfTime setText:[NSString stringWithFormat:@"%@",[df stringFromDate:datePicker.date]]];
  5. selectedDateTime = [datePicker date];
  6.  
  7. UILocalNotification *notification = [[UILocalNotification alloc] init];
  8. NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
  9. //[dateFormat setDateFormat:@"dd-MM-yyyy"];
  10.  
  11. //NSDate *notificationDate = [dateFormat dateFromString:strRemindMeBefore];
  12. notification.fireDate = selectedDateTime;
  13. notification.alertBody = tvMessage.text;
  14. notification.timeZone = [NSTimeZone defaultTimeZone];
  15. notification.soundName = UILocalNotificationDefaultSoundName;
  16. notification.applicationIconBadgeNumber = 1;
  17.  
  18. [[UIApplication sharedApplication] scheduleLocalNotification:notification];
  19.  
  20. NSDate *selectedDateTime = [datePicker date];
  21. NSDate *roundedDate;
  22. NSCalendar *cal = [NSCalendar currentCalendar];
  23. [cal rangeOfUnit:NSMinuteCalendarUnit startDate:&roundedDate interval:NULL forDate:selectedDateTime];
  24. // …
  25. notification.fireDate = roundedDate;
  26.  
  27. NSDateComponents *comps = [[[NSDateComponents alloc] init] autorelease];
  28. [comps setDay:1];
  29. [comps setMonth:1];
  30. [comps setYear:2013];
  31. [comps setHour:10];
  32. [comps setMinute:10];
  33. /// You can set this component as 00
  34. [comps setSecond:00];
  35. localNotif.fireDate = [[NSCalendar currentCalendar] dateFromComponents:comps];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement