2011-05-09 5 views
3

특정 요일에 UILocalNotification의 반복 간격을 사용자 정의하고 싶습니다. 이에 관한 정보를 찾지 못했습니다.특정 요일에 UILocalNotification을 반복하십시오.

일요일, 월요일 및 금요일에 알림을 반복하는 것처럼 특정 요일에 대한 알림의 반복 간격을 프로그래밍하는 방법은 무엇입니까?

+0

나는 동일한 질문이 있습니다. –

답변

4

repeatInterval 속성을 UILocalNotification으로 설정하여 특정 날짜에만 반복하도록 설정할 수는 없습니다. 매일 반복 (매일), 매월 (매월) 또는 매시간 (매시간) 반복을 설정할 수 있습니다. 따라서 가능한 유일한 해결책은 일요일, 월요일 및 화요일에 알람을 설정하려면 하나의 알람이 아닌 3 개의 알람 (일요일, 월요일 및 화요일에 각각 하나씩)을 설정해야한다는 것입니다.

0

사용자 정의 repeatInterval 속성이 필요한 경우. 지정된 시간에 각 UILocalNotification을 설정해야합니다. 여기 내 코드가있다.


    void (^insertAlarm)(NSDate*fire,NSString*sound,int alarmCount) = ^(NSDate*fire,NSString*sound,int alarmCount){ 
     UILocalNotification* notification = [[UILocalNotification alloc] init]; 
     notification.timeZone = [NSTimeZone defaultTimeZone]; 
     notification.soundName = sound; 
     notification.fireDate = fire; 
     notification.repeatInterval = 0; 
     notification.alertLaunchImage = IMG; 
     notification.alertAction = ACTION_MSG;   
     notification.alertBody = BODY; 
     notification.applicationIconBadgeNumber = 1; 
     [[UIApplication sharedApplication] scheduleLocalNotification:notification]; 
     [notification release]; 
    }; 

    insertAlarm(date,sound.fileName,0); 
    insertAlarm([date dateByAddingTimeInterval:60],sound.fileName,1); 
관련 문제