UITabBar在iOS7中的徽章位置 [英] UITabBar badge position in iOS7

查看:114
本文介绍了UITabBar在iOS7中的徽章位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何都要定位UITabBar徽章?它在iOS7中看起来很少流离失所。
在iOS7中,它被转移到下一个标签栏项目。

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;


推荐答案

使用弃用方法时遇到此问题, setFinishedSelectedImage withFinishedUnselectedImage 。相反,使用setImage(imageWithRenderingMode)和setSelectedImage(imageWithRenderingMode)。

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

这篇关于UITabBar在iOS7中的徽章位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆