2012-07-20 24 views
1

我知道如何安排localNotification并设置applicationIconBadgeNumber当localNotification推的applicationIconBadgeNumber:是可以计算当localNotification被称为

- (void) scheduleNotificationOn:(NSDate*) fireDate 
          text:(NSString*) alertText 
          action:(NSString*) alertAction 
          sound:(NSString*) soundfileName 
         launchImage:(NSString*) launchImage 
          andInfo:(NSDictionary*) userInfo 
{ 

    UILocalNotification *localNotification = [[UILocalNotification alloc] init]; 
    localNotification.fireDate = fireDate; 

    .... 

    self.badgeCount ++; 
    localNotification.applicationIconBadgeNumber = self.badgeCount;   

    // Schedule it with the app 
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 
    [localNotification release]; 
} 

正如代码所示,applicationIconBadgeNumber是localNotification之前设置叫做。我想知道是否可以在调用localNotification时计算applicationIconBadgeNumber并将其显示在应用程序图标附近?

回答

0

不,你不能。除非您的应用程序在前台运行,否则您可能会触发本地通知。