2015-01-16 6 views
1

CustomCell을 사용하여 UITableView를 만들었습니다. 로컬 알림이 생성되고 테이블보기가 업데이트 된보기 상단의 버튼을 클릭 할 때 앱이 실행 상태가 아닌 경우 알림이 배너에 표시됩니다. 배너 해당 업데이트 된 UItableviewcell을 시작하는 방법. 키 UIApplicationLaunchOptionsLocalNotificationKey에 의해, 옵션 사전에 : didFinishLaunchingWithOptions : 실행되지 않은 응용 프로그램, 당신은 응용 프로그램에서 지역 알림을 받게됩니다 경우 배너를 클릭하면 ...알림을 클릭하면 UITableViewCell에서 해당 콘텐츠가 표시됩니까?

답변

1

을 도와 드릴까요. 따라서 앱 시작시이 키를 확인하고 로컬 알림이있는 경우 적절한 셀을 표시해야합니다.

0

application : didFinishLaunchingWithOptions 메서드를 사용하여 UILocalNotification을 받고이 메서드에서 NSNotification을 게시 할 수있는 테이블 뷰를 업데이트 할 수 있습니다.

0

sha007 @, 귀하의 경우 응용 프로그램 시작에, 당신은 ...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    // Override point for customization after application launch. 

    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge 
                         |UIRemoteNotificationTypeSound 
                         |UIRemoteNotificationTypeAlert) categories:nil]; 

    [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; 

    // Handle launching from a notification 
    UILocalNotification *localNotif = 
    [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; 
    if (localNotif) { 
     NSLog(@"Handle launching-> Recieved Notification "); 
     localNotif.applicationIconBadgeNumber = 0;// set here the value of badg 

     dicttemp=[NSDictionary new]; 
     dicttemp=[NSDictionary dictionaryWithObject:[localNotif.userInfo valueForKey:@"sent"] forKey:@"sent"]; 

     //Here you can get dictionary from Local Notification(eg.localNotif.userInfo) & using it , Navigate to View Controller & then Reload Data .. 
    } 
    return YES; 
} 

& 당신이 Foregroung 모드의 실행은 다음 코드 아래 사용을 의미 응용 경우, 코드 아래에 작성해야

- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif { 
    // Handle the notificaton when the app is running 
    NSLog(@"Handle the notificaton when the app is running -> Recieved Notification %@",notif); 

    notif.applicationIconBadgeNumber = 0;// set here the value of badge 

    dicttemp=[NSDictionary new]; 
    dicttemp=[NSDictionary dictionaryWithObject:[notif.userInfo valueForKey:@"sent"] forKey:@"sent"]; 

} 
+0

답변 해 주셔서 감사합니다 ..... 이걸 시도하려고합니다 .... – sha007

+0

@ sha007..best of luck..keep coding – Mehul

관련 문제