How to add notifications to icon in iOS application

后端 未结 2 589
南笙
南笙 2021-01-05 04:27

I see that some applications in iPhone show a red circle with the number of notifications from the application, how is that done?

相关标签:
2条回答
  • 2021-01-05 04:47

    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:99]

    Zero value hides the badge.

    0 讨论(0)
  • 2021-01-05 04:54

    It is called a Badge, and it is used for icons, tabbaritems mostly.

    You can set it up like

    UITabBarItem *featured = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:0]; 
    featured.badgeValue = @"1";
    
    0 讨论(0)
提交回复
热议问题