2010-03-19 20 views
18

टैबबार आइटम से बैज को कैसे निकालें, मैंने कोड के नीचे उपयोग किया था लेकिन मेरे लिए काम नहीं कर रहा था।टैबबार आइटम से बैज निकालें

UITabBarItem *chatbadge=[appDelegate.tabBarController.tabBar.items objectAtIndex:2]; 
chatbadge.badgeValue=nil; 

कोई समाधान सुझाएं।

उत्तर

49

ViewController के माध्यम से यह कर का प्रयास करें:

UIViewController *viewController = [appDelegate.tabBarController.viewControllers objectAtIndex:2]; 

viewController.tabBarItem.badgeValue = nil; 
2

स्विफ्ट संस्करण & यह वास्तव में अजीब

self.tabBarController?.viewControllers?[3].tabBarItem.badgeValue = nil 

काम कर रहा है और नहीं

self.tabBarItem.badgeValue = nil 
संबंधित मुद्दे