iOS 7 UINavigationBar has hidden back button

隐身守侯 提交于 2019-12-06 08:10:48

问题


I have an app which has a back button with a custom image in its UINavigationBars. In iOS 6 everything is fine but in iOS 7 the button is 'invisible' most of the time.

When I push a new view controller into the UINavigationController the back button does not appear for the new screen, though if I touch where the button is supposed to be it fades in.

If I set two view controllers on the navigation controller without animation then the button shows up fine but doesn't appear for subsequent pushes.

I'm pretty sure there's nothing in my code that's intentionally hiding the back button and changing the various colours available on the UINavigationBar doesn't make any difference.


回答1:


This is probably due to two new UINavigationBar properties introduced in iOS 7 that you have to implement:

self.navigationController.navigationBar.backIndicatorImage = [UIImage customImage]; self.navigationController.navigationBar.backIndicatorTransitionMaskImage = [UIImage customImage];

From iOS 7 Transition Guidelines:

"If you want to use a custom image to replace the default chevron, you also need to create a custom mask image. iOS 7 uses the mask to make the previous screen’s title appear to emerge from—or disappear into—the chevron during navigation transitions. To learn about the properties that control the Back button and mask image, see UINavigationBar Class Reference."



来源:https://stackoverflow.com/questions/19817453/ios-7-uinavigationbar-has-hidden-back-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!