アラームが1つ付いた時計アプリを作成しています。
アラームを設定するボタン、アラームをオンにするボタン、アラームをオフにするボタンがあります。
設定ボタンは、ローカル通知を使用して機能します。
UILocalNotification *scheduledAlert;
[[UIApplication sharedApplication] cancelAllLocalNotifications];
scheduledAlert = [[UILocalNotification alloc] init];
scheduledAlert.applicationIconBadgeNumber=1;
scheduledAlert.fireDate = alarmPicker.date;
scheduledAlert.timeZone = [NSTimeZone defaultTimeZone];
scheduledAlert.repeatInterval = NSDayCalendarUnit;
scheduledAlert.soundName=@"alarm_clock_ringing.wav";
scheduledAlert.alertBody = @"I’d like to get your attention again!";
[[UIApplication sharedApplication]
scheduleLocalNotification:scheduledAlert];
すべてが正常に機能します。
ただし、オンボタンとオフボタンのコーディング方法がわかりません。