UITabBar badge position in iOS7

大城市里の小女人 提交于 2019-12-11 09:17:53

问题


Is there anyway to position UITabBar badge? It looks little displaced in iOS7. In iOS7, it is displaced towards next tab bar item.

I have used a custom tab bar item.

UINavigationController *navController = [self.viewControllers objectAtIndex: 0];
UIViewController *viewController = [navController.viewControllers objectAtIndex:0];
CustomTabBarItem *tabBarItem = [[CustomTabBarItem alloc] initWithTitle:EMPTY_STRING image: nil tag:2];
[tabBarItem setImageInsets:UIEdgeInsetsMake(-14.5, 0, 14.5, 0)];
tabBarItem.customHighlightedImage= [UIImage imageNamed: @"icon_on.png"];
tabBarItem.customStdImage = [UIImage imageNamed:@"icon_off.png"];
viewController.tabBarItem = tabBarItem;

回答1:


I was having this problem when using the deprecated methods, setFinishedSelectedImage and withFinishedUnselectedImage. Instead, use setImage (imageWithRenderingMode) and setSelectedImage (imageWithRenderingMode).



来源:https://stackoverflow.com/questions/20679253/uitabbar-badge-position-in-ios7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!