Reputation:
I know how to use UILocalNotification
.
My Question is NOT related to custom repeatInterval, i know unfortunately it is not possible to set custom repeatInterval in apple's iOS.
I have just issue of fire notification on proper date that set by user.
I have use (two) UISegmentedControl
(subView of UIScrollView
) added on UIToolBar
.
such like,
After show my image, i hope that may be you understand my question very well.
Button "All" (segment button) want repeat notification daily, and
I done work with set
Repeat Interval => NSDayCalendarUnit
But in others buttons (sun-to-mon)?
I must need to set fireDate base on selected day.
SO, how can i get proper date base on selected day??
For Example:
If i select friday then how can i set my fireDate on date of FriDay ? How can i got it and i also need to repeat notification at specific day whenever its come (i know i need to use NSWeekCalendarUnit
)?
Upvotes: 0
Views: 458
Reputation: 523
Yes you can achieve your goal by using NSWeekCalendarUnit
. But please take care of that Maximum number of scheduled notification is 64. If you are reached the maximum you can't add more local notifications without removing the old ones or after firing the scheduled notifications.
Upvotes: 1
Reputation: 119031
You can create one local notification for each selected day and set it to repeat weekly. For the all button the repeat interval should be set to daily.
For the weekly repeating button you need to calculate the appropriate start date. To do that you want to use NSCalendar
and NSDateComponents
Specifically, the weekday
property of the components. Check this.
Upvotes: 1
Reputation: 213
You can use NSDayCalenderUnit,i hope it will be working for you
Upvotes: 0