以下是我的AppDelegate.m
中的代码:
RootTableViewController *fcTableViewController = [[RootTableViewController alloc]
initWithStyle:UITableViewStylePlain];
fcTableViewController.title = @"root";
UINavigationController *fcNavigationController = [[UINavigationController alloc]
initWithRootViewController:fcTableViewController];
fcNavigationController.navigationBar.translucent = NO;
fcNavigationController.tabBarItem.badgeValue = @"0";
// ?
fcNavigationController.tabBarItem.image = [[UIImage imageNamed:@"icon1"]
imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
fcNavigationController.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
FaiChouViewController *fcViewController = [[FaiChouViewController alloc] init];
UINavigationController *fcNController = [[UINavigationController alloc] initWithRootViewController:fcViewController];
fcNController.navigationBar.translucent = YES;
fcNController.tabBarItem.badgeValue = @"1";
// ...
UITabBarController *fcTabBarController = [[UITabBarController alloc] init];
fcTabBarController.viewControllers = @[fcNavigationController, fcNController, fcpNavigationController];
self.window.rootViewController = fcTabBarController;
这是我的问题:
为什么我手机上的徽章价值1
不在正确的位置?
如何解决?
答案 0 :(得分:0)
昨天前一天我遇到了同样的问题,你可以查看here
只有两行代码可以帮助您入门
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//supplying the animation parameter
[UITabBarItem setDefaultAnimationProvider:[[DefaultTabbarBadgeAnimation alloc] init]];
[UITabBarItem setDefaultConfigurationProvider:[[DefaultSystemLikeBadgeConfiguration alloc] init]];
//rest of your code goes following...
return YES;
}