小编jim*_*mmy的帖子

如何将UIBarButtonItem tintcolor设置为非默认的UIColor

我查看了所有典型的导航栏tintcolor教程和问题.我有一个导航栏的设置色调,但我有一个邮件图标,需要在有邮件时更改为自定义颜色.(如reddit orange邮件图标)

我只能在使用系统UIColors时正确设置色调.

self.leftNavigationBarButton = [[UIBarButtonItem alloc] initWithImage:someImage style:UIBarButtonItemStylePlain target:self action:@selector(foo:)];
self.navigationItem.leftBarButtonItem = self.leftNavigationBarButton;

self.leftNavigationBarButton.tintcolor = [UIColor redColor];
Run Code Online (Sandbox Code Playgroud)

但是,如果我然后使用自定义颜色.

self.leftNavigationBarButton.tintcolor = [UIColor colorWithRed:100 green:40 blue:20 alpha:1.0];
Run Code Online (Sandbox Code Playgroud)

它使图标变白.有谁知道发生了什么或我如何使用自定义颜色?

uibarbuttonitem uicolor tintcolor ios

5
推荐指数
1
解决办法
3658
查看次数

标签 统计

ios ×1

tintcolor ×1

uibarbuttonitem ×1

uicolor ×1