У меня есть этот первый метод планирования локального уведомления:
- (void) scheduleLocalNotificationWithDate:(NSDate *)fireDate
{
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.fireDate = fireDate;
notification.category = @"Alarm";
notification.soundName = @"Pager.caf";
[[UIApplication sharedApplication] scheduleLocalNotification: notification];
}
Затем я создал представление выбора, в котором пользователь может выбрать сигнал будильника в списке с помощью этого метода:
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
inComponent:(NSInteger)component
{
NSString *resultString = _alarmNames[row];
_alarmToneText.text = resultString;
}
Теперь я хочу отредактировать метод scheduleNotification, чтобы вызвать текстовое значение в представлении выбора, которое равно resultString, и поместить его в уведомление.soundName.
Вот как будет выглядеть код:
notification.soundName = resultString;
- (void) scheduleLocalNotificationWithDate:(NSDate *)fireDate andSound:(NSString*)sound
и вызвать его из-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
. - person user996142   schedule 10.09.2015