0

In myapp i am having tab button items 1. 0-10pounds 2. 10-50pounds 3. Partial truck buttons.

if i click 0-10pounds item i have to show a badge increased to 1 for the same item. Thanks in advance.

Vignesh
  • 35
  • 1
  • 8
  • If i understand it correctly you are using uitabbar so you need to do: self.navigationController.tabBarItem.badgeValue = @"{your_value}"; – Ran Hassid Jul 18 '16 at 08:46
  • I have to increase value for every click @Ran Hassid – Vignesh Jul 18 '16 at 08:48
  • You need to increase the value of the tab item that you clicked on ? – Ran Hassid Jul 18 '16 at 08:48
  • Create a counter to keep track then + the counter value and assign it to the badgeValue as @RanHassid mentioned – Happiehappie Jul 18 '16 at 08:49
  • @Vignesh - you need to increase it only if the item was not selected and then the user selected it or you increase it anyway ? – Ran Hassid Jul 18 '16 at 08:52
  • @RanHassid badge count have to increase only if user selects the button. – Vignesh Jul 18 '16 at 08:55
  • So in that case you have 2 options: 1. Call the above code in viewWillAppear method of your view controller and increase the badge 2. Use UITabBarControllerDelegate and do it in the - tabBarController:didSelectViewController: delegate method (the recommended way from my POV) – Ran Hassid Jul 18 '16 at 08:57

0 Answers0