I have a tab bar controller, that has 3 view controller attached.
Say you start up the app, the first view controller is the only view out of the other three that is loaded. I want set the badge value of the third view controller that isn't loaded. This is because I want the user to know they have notifications when they open the app.
Is it possible and how can I do it? I have tried the following:
Calling the view ( the one that I want to change its badge ) from another class:
NotificationsViewController *class = [NotificationsViewController alloc]init];
[class view];
Then, In the NotificationsViewController class, I set the badge to 1 if the app has any notifications using parse:
- (void)viewDidLoad {
[super viewDidLoad];
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
if (currentInstallation.badge > 0) {
NSString *badge = @"1";
[self.tabBarItem setBadgeValue:badge];
}
}
Why isn't this working? How can I change the badge of the view controller that isn't loaded yet?