【发布时间】:2015-11-23 16:45:17
【问题描述】:
我有那个导航控制器,我正在通过代码添加 1 个按钮:
UIBarButtonItem *configButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"config.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(showConfigWindow)];
self.navigationItem.leftBarButtonItem = configButton;
它工作正常,但图标是黑色而不是白色!
如果我使用这个:
UIBarButtonItem *configButton = [[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStyleBordered target:self action:@selector(showConfigWindow)];
文本以白色正确显示。
这些图标没问题,因为我通过界面生成器使用它们并且它们显示正确。
【问题讨论】:
-
你能提供一张正在发生的事情的图片吗?你确定你的图片格式正确并且没有被反转,出于某种原因吗? (尝试另一种颜色,看看会发生什么)
-
看看这里:personales.upv.es/jorfermo/screenshot.jpg 这是 UIButton 中的同一张图片。上一个在导航控制器上,下一个在 uitoolbar 上。