我有一个 iOS 应用程序,它使用自定义后退 V 形符号作为导航栏中的后退按钮,具有自定义背景颜色和阴影等。我想将该背面指示器图像的颜色设置为默认蓝色以外的颜色。如何使用新的UINavigationBarAppearance
API 做到这一点?
我努力了:
- 将背面指示器图像设置为我的形状的模板图像 - 这有效,但不影响颜色。
- 设置
titleTextAttributes
的normal
变体buttonAppearance
,指定NSForegroundColorAttributeName
- 设置,
titleTextAttributes
的所有变backButtonAppearance
体NSForegroundColorAttributeName
NSBackgroundColorAttributeName
- 直接在导航栏上设置
tintColor
- 这会影响新导航项动画期间的后退指示器,但在动画结束时它会变回蓝色。