2013-05-28 69 views
0

你好我正在與LocalNotifications應用程序。我想創建一個處理程序,當用戶點擊NotificationBar中的通知時,它會向他展示具有標題和描述符的新Viewctontroler,它們將從Notification中接收。LocalNotification點擊不處理程序

UILocalNotification *notif; 

     for(int i=0 ; i<[idnoty count]; i++){ 
     notif=[[UILocalNotification alloc]init]; 
      if (notif == nil) return; 


    notif.fireDate = [NSDate date];// Now here you can manage the fire time. 
    notif.timeZone = [NSTimeZone defaultTimeZone]; 
    [notif setHasAction:NO]; 
    notif.timeZone = [NSTimeZone localTimeZone]; 
    notif.alertBody = [titlenoty objectAtIndex:i]; 
     notif.alertAction=[descrnoty objectAtIndex:i]; 
     notif.applicationIconBadgeNumber = i+1; 
     notif.soundName = UILocalNotificationDefaultSoundName; 
    NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Object 2",@"Key 2", nil]; 
     notif.userInfo = infoDict; 

       //apostolh gia na svisei ta push 
    NSString *URLTest=[dict objectForKey:@"URL"]; 
    NSString *URL1=[NSString stringWithFormat:@"%@%@",URLTest,@"push.php?"]; 

    NSString *strURL1 = [NSString stringWithFormat:@"%@id=%@",URL1,[idnoty objectAtIndex:i]]; 


NSData *dataURL1 = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL1]]; 

[[UIApplication sharedApplication] scheduleLocalNotification:notif ]; 

} 

回答

0

你可以這樣做處理中

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification 
+0

和我如何會知道是什麼錄音通知。如果我有n + 1個通知? – Cliff

+0

這將與您在「通知中心欄/視圖」 – samfisher

+0

中互動的通知調用此方法將調用n + 1次? – Cliff