그래서 저는 당신의 도움이 필요합니다. 특정 날짜와 시간에 알림 코드를 설정해야합니다. 내 코드를 수정하도록 도와주세요.
UILocalNotification* n1 = [[UILocalNotification alloc] init];
n1.fireDate = [NSDate dateWithTimeIntervalSinceNow: 6];
n1.alertBody = @"one";
UILocalNotification* n2 = [[UILocalNotification alloc] init];
n2.fireDate = [NSDate dateWithTimeIntervalSinceNow: 15];
n2.alertBody = @"two";
[[UIApplication sharedApplication] scheduleLocalNotification: n1];
[[UIApplication sharedApplication] scheduleLocalNotification: n2];
NSDate
특정 시간에 를 만드는 방법을 모르는 것 같습니다 . NSDateFormatter
문자열을 날짜로 변환하는 데 사용 합니다.
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd HH:mm"];
NSDate *myDate = [df dateFromString:@"2014-04-05 23:30"];
UILocalNotification* n1 = [[UILocalNotification alloc] init];
n1.fireDate = myDate;
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다