iphone开发必知点之--清除和设置桌面提示泡泡计数

当app重新打开或切换到前台时,在app委托applicationWillEnterForeground:方法里实现

清除泡泡计数

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // clear badage
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
}

在app被激活时,设置泡泡计数

- (void)applicationDidBecomeActive:(UIApplication *)application
{
  NSInteger testBadgeNum = 10;
  [[UIApplication sharedApplication] setApplicationIconBadgeNumber:testBadgeNum]; 

}

 

 
 
posted @ 2014-10-01 01:11  许文斌  阅读(213)  评论(0编辑  收藏  举报