You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a (custom) uibutton as a barbuttonitem, and whenever I call .badgeValue or setBadgeValue it only gets updated after the view is reloaded (viewwillappear called)
The text was updated successfully, but these errors were encountered:
This is old, but leaving this for anyone else that may run into this issue. If you're updating the badge from the appDelegate, you can do the following. My app uses a UITabBarController with UINavigationControllers in each tab, and a UITableViewController or UIViewController in each UINavigationController.
NSInteger count = ...;
//get the root view controller
UITabBarController *tabBar = (UITabBarController*)self.window.rootViewController;
//get the navigation controller
UINavigationController *nvc = (UINavigationController*)tabBar.selectedViewController;
//get the view controller
UITableViewController *table = [nvc.childViewControllers objectAtIndex:0];
//update the badge
table.navigationItem.leftBarButtonItem.badgeValue = [NSString stringWithFormat:@"%li", (long)count];
All of this goes into my didReceiveRemoteNotification method so it triggers whenever a notification is received.
I've got a (custom) uibutton as a barbuttonitem, and whenever I call .badgeValue or setBadgeValue it only gets updated after the view is reloaded (viewwillappear called)
The text was updated successfully, but these errors were encountered: