前几天有童鞋问我怎样在程序的ICON上显示数字,当时没多想——“不清楚

    今天回想起来,觉得应该是UIApplication的一个属性,就查了下API,果然找到了这个属性:

@ property(nonatomic) NSInteger applicationIconBadgeNumber;  // set to 0 to hide. default is 0

 

    就结合手上正在做的项目,看看效果(在程序退出时,显示今日要处理的事件数目):

- (void)applicationDidEnterBackground:(UIApplication *)application{

[[UIApplication sharedApplicationsetApplicationIconBadgeNumber:

           _homeViewController._dayViewController.eventCountOfToday];

}

  

    效果:在程序的ICON上显示数字

 

 

 

 

相关文章:

  • 2021-06-21
  • 2022-12-23
  • 2022-01-14
  • 2021-10-29
  • 2022-01-30
  • 2021-10-18
  • 2021-07-14
  • 2021-06-28
猜你喜欢
  • 2022-12-23
  • 2021-12-04
  • 2021-12-15
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
相关资源
相似解决方案