【发布时间】:2017-11-28 09:39:16
【问题描述】:
我在 iOS 11 中遇到了自定义 BackButton Image 颜色的问题。
BackButton Image 在 iOS 11 更低的版本中可以正常工作。
我使用以下代码自定义了UINavigationBar 的后退按钮图像。
[[UINavigationBar appearance] setBackgroundColor:[UIColor blackColor]];
[[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTranslucent:false];
UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 5.0f, 0);
UIImage *backArrowImage = [[UIImage imageNamed:@"icon_nav_back"] imageWithAlignmentRectInsets:insets];
[[UINavigationBar appearance] setBackIndicatorImage:backArrowImage];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:backArrowImage];
在低于 iOS11 的版本中显示正确的图像,默认颜色的图像
但是,在 iOS 11 版本中,它的颜色和大小不合适。
请提供适当的解决方案来解决此问题。
我也尝试过 Tint Color,但它不起作用。
【问题讨论】:
-
检查这个 SO 问题:stackoverflow.com/questions/28733936/…
-
@Damo 我已经尝试了所有这些解决方案。这对我没有帮助。
标签: ios objective-c image uinavigationbar ios11