2012-08-12 7 views
1

하나의 알람으로 시계 앱을 만들고 있습니다.버튼으로 알람 알림 켜고 끄기

알람을 설정하는 버튼, 알람을 켜는 버튼 및 알람을 끄는 버튼이 있습니다. 로컬 알림을 사용

SET 버튼 작동 :

UILocalNotification *scheduledAlert; 
[[UIApplication sharedApplication] cancelAllLocalNotifications]; 
scheduledAlert = [[UILocalNotification alloc] init]; 
scheduledAlert.applicationIconBadgeNumber=1; 
scheduledAlert.fireDate = alarmPicker.date; 
scheduledAlert.timeZone = [NSTimeZone defaultTimeZone]; 
scheduledAlert.repeatInterval = NSDayCalendarUnit; 
[email protected]"alarm_clock_ringing.wav"; 
scheduledAlert.alertBody = @"I’d like to get your attention again!"; 
[[UIApplication sharedApplication] 
        scheduleLocalNotification:scheduledAlert]; 

모든 것이 잘 작동합니다.

그러나 켜기 및 끄기 버튼을 코딩하는 방법을 알지 못합니다.

답변

0

끄기 버튼의 경우 CancelAllCurrentNotifications과 같은 것을 사용해야합니다.

+0

나는 CancelAllCurrentNotifications에 대해 정말로 조언하고 싶습니다. http://weblog.bignerdranch.com/780-notifications-part-3-gotchas/ – Daniel