首页 > 代码库 > iphone开发必知点之--清除和设置桌面提示泡泡计数

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]; 

}

 

 
 

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