问题
I Have two notification and I want to repeat it alternative week.
E.g. One notification set on 1st week's monday and it should repeat on 3rd week's monday. Second notification set on 2nd week's tuesday and it should repeat on 4th week's tuesday.
What should I do for this?
回答1:
Get week number and make decision according to week number
回答2:
-(NSString*) getWeekOfMonth {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
[dateFormatter setDateFormat:@"W"];
NSString *weekNumber = [dateFormatter stringFromDate:[NSDate date]];
[dateFormatter release];
return weekNumber;
}
NSInteger weekInt = [weekNumber integerValue];
来源:https://stackoverflow.com/questions/13116325/local-notification-alternative-week-repeat