【问题标题】:remove blue outline from uitabbaritem image从 uitabbaritem 图像中删除蓝色轮廓
【发布时间】:2012-06-07 03:39:21
【问题描述】:

I have changed the tabBar.selectedImageTintColor to my own purlple color however when the tabbar item is selected there is a bright blue line that surrounds the outside of the image which is now purple..

这看起来很糟糕,所以现在我正在尝试找到一种方法来删除它或将其更改为更好的匹配颜色。

但是我不知道该怎么做,希望有人能告诉我。

这是我说的蓝线

这就是我将图像选择颜色更改为紫色的方式...

 myTabBar.selectedImageTintColor = [UIColor colorWithRed:49.0/255.0 green:0.0/255.0 blue:98.0/255.0 alpha:0.95];

另一个带有放大标签图标的蓝色轮廓示例

【问题讨论】:

  • 您可以为标签栏项目使用自定义图像。
  • 是的,我使用的是自定义图像,但它仍然添加了那个有趣的蓝色轮廓。我会做一个屏幕截图。
  • 你能贴一些你用过的代码吗?
  • 如何设置标签栏的自定义图像?我已经将上面的代码用于标签栏默认按钮并且工作正常。
  • self.button1.image = [UIImage imageNamed:@"icon1.png"];

标签: iphone ios uitabbar uitabbaritem


【解决方案1】:

在 iOS 5 中,您可以设置外观方法。

完全按照您希望它们显示的方式创建未选择和选择的图像,然后setFinishedSelectedImage: withFinishedUnselectedImage: iOS 不会对您通过此方法提供的图像应用任何格式。

UIImage *selectedImage = [UIImage imageWithName:@"my_finished_selected_image"];
UIImage *unselectedImage = [UIImage imageWithName:@"my_finished_unselected_image"];
[tabBarItem setFinishedSelectedImage:selectedImage withFinishedUnselectedImage:unselectedImage];

【讨论】:

  • 此方法有效,但现在已弃用。你知道 iOS 7 的版本吗?
猜你喜欢
  • 2013-04-17
  • 2020-01-07
  • 2020-08-04
  • 1970-01-01
  • 1970-01-01
  • 2016-08-04
  • 2020-09-23
  • 1970-01-01
  • 2020-06-14
相关资源
最近更新 更多