iOS Back Button Vertical Position


iOS Back Button Vertical Position



I have a custom back button in my app in the Navigation Bar and for the life of me, cannot figure out why it is being pushed up. It is in normal position in iOS 11.0 and up, but for any version below 11.0, the image is pushed slightly up vertically (with the top of the button touching the bottom of the status bar).



App Delegate Code:


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

let navigationBarAppearace = UINavigationBar.appearance()
UINavigationBar.appearance().backIndicatorImage = UIImage(named: "backButton")
UINavigationBar.appearance().backIndicatorTransitionMaskImage = UIImage(named: "backButton")
UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffset(horizontal: 5.0, vertical: -60.0), for: .default)



Has anyone else encountered this?



Edit: Added two screenshots. First one shows on simulator in iOs 9.3 (the lowest version I need to support) and second shows in iOS 11.4. The second screenshot in 11.4 is how the button should be positioned.



Simulator iOS 9.3
Simulator iOS 11.4





Perhaps add a screenshot of what is happening and what should be happening. Is it happening only on an iPhone X device/sim or it is strictly the iOS version?
– Steve
Jun 30 at 2:45





That would help wouldn't it :) I just dropped some in.
– Kevin
Jun 30 at 2:53





Can you show the code of custom back button?
– MoLice
Jun 30 at 12:50





Code snippet added
– Kevin
Jun 30 at 14:23









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to input without newline? (Python)

C++ thread error: no type named ‘type’ MINGW

Analog for TagView in flutter