tabBarアイテムに問題があるようです。tabBarの作成を行うと、tabBarItemのこのプロパティを次のように設定できます。
viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UIViewController *viewController3 = [[ThirdViewController alloc]initWithNibName:@"ThirdViewController" bundle:nil];
UIViewController *viewController4 = [[FourthViewController alloc]initWithNibName:@"FourthViewController" bundle:nil];
//Create our NavigationViewController object
NavigationViewController *navController = [[NavigationViewController alloc] initWithNibName:@"NavigationViewController" bundle:nil];
//Create our UINavigationController
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:navController];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[nav, viewController2, viewController4, viewController3];
nav.tabBarItem = [[UITabBarItem alloc]
initWithTitle:(@"Menukort")
image:[UIImage imageNamed:@"162-receipt.png"]
tag:0];
viewController2.tabBarItem = [[UITabBarItem alloc]
initWithTitle:(@"Favoritter")
image:[UIImage imageNamed:@"28-star.png"]
tag:1];
viewController3.tabBarItem = [[UITabBarItem alloc]
initWithTitle:(@"Info")
image:[UIImage imageNamed:@"104-index-cards.png"]
tag:2];
viewController4.tabBarItem = [[UITabBarItem alloc]
initWithTitle:(@"Kort")
image:[UIImage imageNamed:@"103-map.png"]
tag:3];
viewController2.tabBarItem.badgeValue = @"1";
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
このコードはすべてシングルトン内にあるため、オブジェクトの共有は問題になりません。さて、このtabBarItemのbadgeValueを別のクラスに設定するにはどうすればよいですか?
前もって感謝します。