Set multiple UILocalNotification

2020-04-19 22:32发布

问题:

I need to set Different UILocalNotification

i have

StartDate:Starting date from which notification starts(using date picker)
EndDate: enddate upto when notfication fire(using date picker)

//choose different time (max 5 time) from date picker

time1tofire:HH:MM
time2tofire:HH:MM
time3tofire:HH:MM
time4tofire:HH:MM
time5tofire:HH:MM

i know i can set different reapeat daily UILocalNotification with following property of CalenderUnit

NSEraCalendarUnit
NSYearCalendarUnit
NSMonthCalendarUnit
NSDayCalendarUnit
NSHourCalendarUnit
NSMinuteCalendarUnit
NSSecondCalendarUnit
NSWeekCalendarUnit
NSWeekdayCalendarUnit
NSWeekdayOrdinalCalendarUnit
NSQuarterCalendarUnit

And setting simple notification like

- (IBAction)addNotification:(id)sender {
                UILocalNotification *localNotification = [[UILocalNotification alloc] init]; //Create the localNotification object
                [localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:[datePicker countDownDuration]]]; //Set the date when the alert will be launched using the date adding the time the user selected on the timer
                [localNotification setAlertAction:@"Launch"]; //The button's text that launches the application and is shown in the alert
                [localNotification setAlertBody:[alertBodyField text]]; //Set the message in the notification from the textField's text
                [localNotification setHasAction: YES]; //Set that pushing the button will launch the application
                [localNotification setApplicationIconBadgeNumber:[[UIApplication sharedApplication] applicationIconBadgeNumber]+1]; //Set the Application Icon Badge Number of the application's icon to the current Application Icon Badge Number plus 1

                [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; //Schedule the notification with the system
                [localNotification release];

                [alertNotification setHidden:NO]; //Set the alertNotification to be shown showing the user that the application has registered the local notification
            }

MY question are:

How to Bound UILocalNotification to fire between StartDate to End Date?

How to set UILocalNotification in those days with different time (choose by HH:ss format using date picker)using CalenderUnit?