2014-12-05 2 views
0

알람 시간 평행에 울리는 때 UILocalNotification 으로 나는 사용자 정의보기를 열고 자.
동일한 코드에 다음 코드를 사용하고 있습니다.
알람이있는보기를 여는 방법은 무엇입니까?

UILocalNotification *notification = [[UILocalNotification alloc] init]; 
if (notification == nil) 
    return; 
NSDate *dt = [NSDate dateWithTimeInterval:10 sinceDate:[NSDate date]]; 
notification.fireDate = dt; 
notification.timeZone = [NSTimeZone defaultTimeZone]; 

notification.alertBody = @"After 10Secs..."; 
notification.alertAction = @"View"; 
[[UIApplication sharedApplication] scheduleLocalNotification:notification]; 

이 코드로만 알림이 실행됩니다.

enter image description here

+0

당신이 명확히 수하시기 바랍니다에 대한 광범위한 프로그래밍 가이드가 있습니다. 사용자 정의보기를 말할 때. 알림이 사용자 정의보기임을 의미합니까, 아니면 알림이 탭되면 사용자 정의보기가 앱에서 표시됩니까? –

+0

@Naughty_Ottsel 예, 알림은 사용자 정의보기입니다. 또는 가능한 경우 알림을 탭하면 사용자 정의보기가 열립니다. – shahnilay86

답변

0

지금 설명은 당신이 찾고있는 무엇에 설정되었습니다.

알림 사용자 지정 뷰 수 없습니다. 그들은 애플에 의해 처리되며 모두 똑같이 보입니다. 응용 프로그램 이름, 아이콘 및 알림 본문 만 변경됩니다. 당신이 알림을 예약 할 때

그러나, 당신은 통지의 사용자 정보 속성에 사용자 정의 데이터를 저장할 수 있습니다. 당신이 didFinishLaunchingWithOptions의 대리인 전화를받을 때

그런 다음, 당신은 당신의 통지 옵션 dicitionary를 확인할 수 있습니다. 사용자 정보를 확인하고 귀하의 사용자 정의보기와의 ViewController를 표시합니다.

애플은 Notifications here

+0

사전의 세부 사항을 가져 오는 방법은 무엇입니까? 동일한 코드를 제공 할 수 있습니까? – shahnilay86

+0

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/FoundationTypesandCollections/FoundationTypesandCollections.html#//apple_ref/doc/uid/TP40011210-CH7-SW15 –

+0

- (BOOL) 응용 프로그램 :(UIApplication *) 앱 didFinishLaunchingWithOptions : (NSDictionary와 *) launchOptions { UILocalNotification * localNotif = [launchOptions objectForKey : UIApplicationLaunchOptionsLocalNotificationKey]; if (localNotif) { NSString * itemName = [localNotif.userInfo objectForKey : ToDoItemKey]; [viewController displayItem : itemName]; // 사용자 정의 메서드 app.applicationIconBadgeNumber = localNotif.applicationIconBadgeNumber-1; } [window addSubview : viewController.view]; [window makeKeyAndVisible]; return YES; } –

관련 문제