2

I have a two tab bar items at the bottom of my application. (Let's call the tab bar items Products & Cart) On Cart their is a badge item present. How can I change the badge item on Cart while I preform an action on the ViewController of Products.

Steps: Start -> Cart badge = 0 -> go to Products tab -> add product to cart -> while adding product to cart change Cart badge to 1 -> still on the Products tab

Renzzs
  • 1,046
  • 2
  • 11
  • 20

1 Answers1

2

Assuming two tabs and cart is second the index of the cart viewcontroller is 1. In you productsview controller you should be able to:

tabBarController.viewControllers[1].tabBarItem.badgeValue = "1";

I'm not at work and cant test is now. Hope te test it tomorrow.

svn
  • 1,235
  • 10
  • 22