更新时间:2022-12-30 20:41:15
设置 BackButtonBackgroundImage
通过 UIAppearance
目前在iOS 7中有一些奇怪的行为。这可能与更新的设计有关,它将rect-style按钮替换为backIndicatorImage(箭头)。
Setting BackButtonBackgroundImage
via UIAppearance
currently has some odd behavior in iOS 7. This is probably related to the updated design, which replaces the rect-style button with a backIndicatorImage (an arrow).
这留下了3个用于自定义后退按钮外观的选项:
This leaves 3 options for customizing the back button's appearance:
通过设置 UINavigationBar (或其中一个超类)的c $ c> tintColor 属性。
Change the color of the backIndicatorImage by setting the tintColor
property on UINavigationBar
(or one of its superclasses).
在 UINavigationBar
上设置新的 backIndicatorImage
属性>到自定义图像。 (不要忘记设置 backIndicatorTransitionMaskImage
,否则它将无效)
Set the new backIndicatorImage
property on UINavigationBar
to a custom image. (don't forget to set the backIndicatorTransitionMaskImage
as well or it won't work)
创建自定义 UIBarButtonItem
并手动将其指定为 UINavigationItem
的 leftBarButtonItem
。 (参见上面提到的答案 Mashhadi )
Create a custom UIBarButtonItem
and manually assign it as UINavigationItem
's leftBarButtonItem
. (See the answer mentioned above by Mashhadi)