- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我有一个使用 Storyboards 的项目,每当我使用 segue 推送 View Controller 时,动态创建的条形按钮项始终是蓝色的。
这让我发疯了。因为这个对象是动态创建的,所以我不能在 IB 中设置它的颜色(就像我对之前的条形按钮项目所做的那样)。
我尝试过的解决方案有:
viewDidLoad
在接收者的viewDidAppear
self.navigationItem.backBarButtonItem.tintColor = [UIColor whiteColor];
当我发现这不太行时,我尝试设置 leftBarButtonItem:
self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
在调用新 View 时以及在推送新 View 之前,我在应用程序的委托(delegate)中尝试了以下代码(我从其他 SO 答案中获得):
[[UIBarButtonItem 外观] setTintColor:[UIColor whiteColor]];
我找到的所有谷歌答案都建议使用上面的代码,但它对我来说根本不起作用。或许 iOS 7 的外观 API 有一些变化?无论我如何或在何处尝试将“Categorías”设置为白色,它始终是默认的蓝色。
最佳答案
在 iOS 7 中,要设置应用程序中所有 barButtonItems 的颜色,请在 AppDelegate 中设置应用程序窗口的 tintColor
属性。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.tintColor = [UIColor whiteColor];
return YES;
}
更多详细信息见 Apple's iOS 7 UI Transition Guide (特别是在“使用色调颜色”部分)。
***或***
根据一些评论,您也可以使用 UINavigationBar 外观代理来实现这一点。这将只影响 UIBarButtonItems 的 tintColor,而不是在窗口上设置 tintColor 并影响该窗口的所有 subview 。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if([UINavigationBar conformsToProtocol:@protocol(UIAppearanceContainer)]) {
[UINavigationBar appearance].tintColor = [UIColor whiteColor];
}
return YES;
}
关于ios - 更改 UIBarButtonItem 的 Tint 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19504291/
我是否在仅使用全局色调设置应用程序整体色调时忽略了一些东西? 我在 IOS 7.06 中运行的应用程序在 IOS 7.1 更新后今天突然发生了变化。 基本 Storyboard ,基于选项卡的应用程序
我试着用这样的背景属性给图像着色: .image-holder:hover { opacity: 1; transition: opacity 1s, background 1s; bac
假设分段控件的色调颜色设置为 RGB(69, 175, 225),但颜色选择器的实际颜色范围从(最上面的)RGB(146, 181, 211) 到(最下面的)RGB(82, 118、147)。 那么我
在国际象棋小程序的框架内,我有几套这样的灰度/黑白(不确定): 有什么方法可以通过 Java 代码为 PNG 图片赋予色调?尝试用谷歌搜索此事,但没有找到任何真正符合我正在寻找的东西。 例如,对于下面
我看过人们用来给图像着色的各种方法(我想应用红色层),而我唯一要使用的方法非常复杂。有没有更简单的方法? // 1. Tint the Image NSString *
我的android项目构建失败,可以构建成功。 构建:同步 ../../../.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.0.aar
我正在使用导航栏色调颜色设置导航栏后退按钮,当我使用 native 颜色时它可以工作,而当我使用图像中的自定义颜色时它会失败。 工作代码: self.navigationController?.nav
我只是想在 Symbian 中将 TBuf 转换为 TInt。我尝试通过以下方式进行: TBuf buf; buf.Copy( _L("10")); TInt valInt; TLex8 lex(bu
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
我不知道这个错误是怎么开始的,我昨天干脆关闭了android studio,我关了pc,今天,我打开了pc,打开了android studio,然后打开android很快就出现了这个错误工作室。 我尝
我为整个应用程序的图标使用色调。 我的 ImageView 中的示例: 我还使用 EditText 中的一些图标作为其可绘制对象: 但是,我找不到任何可用于在 EditText 中为可绘制对象着色
我想向 UIBarButtonItem 添加图像。 我的代码: let button1 = UIBarButtonItem(image: UIImage(named: "icon1")
开始学习 Swift 并尝试转换此 ObjectiveC 代码: [[mySegmentedControl.subviews objectAtIndex:0] setTintColor:[UIColo
我试图在 p5 中更改屏幕外图形缓冲区的不透明度,但无法弄清楚。 考虑: var pg = createGraphics(...) var image = loadImage(...) tint(25
我正在尝试实现导航栏具有“透明模糊”效果的效果。我已经能够通过一个问题达到预期的效果。导航栏是“黑色透明”的颜色。我正在寻找它是一种“白色透明”的颜色。这是当前输出的图像: 我已经对该主题进行了很多谷
我需要在 iOS 7 上将 Android 状态栏设置为半透明,带有类似色调效果的颜色,我查看了文档,但它只解释了如何获得渐变半透明状态栏。 我已经在 Samsung Galaxy S5 stock
我正在使用 Pod Tabman 来轻松使用标签栏 Controller 但我无法在选择按钮时更改图像颜色。 我已经尝试了一些方法,比如为色调颜色渲染 ImageView ,但到目前为止,没有任何改变
这个问题很简单,但我似乎找不到解决方案。我有一个个人资料图片,我想在悬停时对其进行着色。正如您在代码片段中看到的那样,它可以工作,但仅当图像不可见时才有效。它是本地镜像,所以我特意展示了图像存在和不存
我正在开发 Android 应用程序。我有一个包含许多图像按钮的主菜单,每个图像按钮都会让用户在点击时进入一个新 View 。 我遇到的问题是,每个图标周围都是一个有色矩形,点击时会变成浅蓝色。如何删
我想保留一些图标不着色,一些图标着色。现在我有: app:itemIconTint="@color/menu_icons_selector" 它为所有图标着色。 我正在尝试让所有图标都不着色 mNav
我是一名优秀的程序员,十分优秀!