Plo*_*lot 2 customization uinavigationbar uitabbar tintcolor ios
我正在一个项目,我需要创建一个自定义UINavigationBar和UITabBar.我的问题在于物品的颜色(浅色!).我不希望我的物品有任何色彩.我试图把它弄清楚颜色,但这只会让它消失(变得透明).
所以,总结一下,我有自己的酒吧项目图片,每个都包含自己特定的颜色.我已经读过,为了做我想做的事情,我必须继承我的UIBars,但我没有比这更多的信息.我应该在子类中修改什么来摆脱那种色彩约束?谢谢.
编辑:色调颜色不应用于项目,而是应用于栏(所以所有项目).所以我的问题是我需要特定颜色的物品
编辑2:好的,我想我明白了!解决方法是使用UIBarButtonItem方法:initWithCustomView:
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
backBtn.bounds = CGRectMake( 0, 0, 26, 26);
[backBtn setImage:[UIImage imageNamed:@"BackBtn.png"] forState:UIControlStateNormal];
[backBtn addTarget:self.navigationController action:@selector(popViewControllerAnimated:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
self.navigationItem.leftBarButtonItem = item;
Run Code Online (Sandbox Code Playgroud)
但这只适用于UINavigationBar因为它需要UIBarButtonItem.UITabBar另一方面只采取UITabBarItem不符合的initWithCustomView.所以我还在那里泡菜......
小智 5
问题是前一段时间被问到的,但我在google中找到了它,所以其他人也可能会发现它:)
答案是使用这种方法
UITabBarItem(title:, image:, selectedImage:)
使图像打开始终原始的渲染模式
image.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
希望有所帮助!