Local Notification alternative week repeat

时光毁灭记忆、已成空白 提交于 2019-12-10 21:27:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!