You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS 26下UIBarButtonSystemItemDone不遵循全局tintColor设置且手动设置后对勾显示异常的问题求助

iOS 26下UIBarButtonSystemItemDone不遵循全局tintColor设置且手动设置后对勾显示异常的问题求助

各位iOS开发的朋友们,我最近在iOS 26环境下开发时碰到了一个头疼的问题,想过来请教下大家有没有类似的经验或者解决思路:

我用系统自带的Done样式创建了导航栏右侧按钮,代码如下:

UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(save:)];
self.navigationItem.rightBarButtonItem = saveButton;

默认状态下这个按钮显示的是系统自带的蓝色背景+对勾样式,这部分是正常的。但我在AppDelegate里通过Appearance全局设置了App的统一tintColor,代码是这样的:

UIColor *appTintColor = [UIColor appTintColor];
[UIBarButtonItem appearance].tintColor = appTintColor;
[UIButton appearance].tintColor = appTintColor;

奇怪的是,这个Done样式的按钮完全不遵循全局的tintColor设置,还是固执地显示系统默认的蓝色。

后来我试着手动给这个按钮单独设置tintColor:

saveButton.tintColor = [UIColor appTintColor];

结果反而更糟——按钮上的对勾变得几乎半透明,显示效果完全不符合预期。

我自己研究了相关问题,也尝试了上面这个手动设置的方法,但始终没解决问题,有没有朋友遇到过类似的情况,能给我点建议吗?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.07 09:02:59