Search code examples
xcodeuitabbarxcode-storyboard

What is the "Badge" field for in a Tab Bar Item's attributes inspector?


I'm familiar with badges, and working with them from code, but the Attributes Inspector for a Tab Bar Item has a Badge field. What is this field for?

enter image description here


Solution

  • It's for displaying an indicator above the tab bar icon. It's useful for notifying the user that there is new data available on a certain tab.

    From the UITabBarItem documentation:

    Text that is displayed in the upper-right corner of the item with a surrounding red oval.

    A screenshot of a tab bar icon with a badge value of 3

    Above is a tab bar item with a Badge value of 3 set in the storyboard.

    (This value can also be set programmatically with the badgeValue property.)