Native back buttons are buggy on iOS 11 as shown in the picture. Is there a solution for this?
Asked
Active
Viewed 701 times
3

Community
- 1
- 1

Shahbaz Akram
- 1,598
- 3
- 28
- 45
-
Did you try self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic; – Avijit Nagare Sep 27 '17 at 06:52
-
yes but not working . – Shahbaz Akram Sep 27 '17 at 07:24
-
you added any code for setBackButtonTitlePositionAdjustment ? This will be reason for this issue. – RashmiG Oct 05 '17 at 10:09
-
No i am not using it. – Shahbaz Akram Oct 05 '17 at 12:14
-
But i am using IQKeyboardManager which used this code. – Shahbaz Akram Oct 05 '17 at 12:15
-
Solution is here: https://stackoverflow.com/questions/46193204/custom-back-indicator-image-and-ios-11 – Yun CHEN Oct 09 '17 at 08:46
-
IQKeyboardManager uses setBackButtonTitlePositionAdjustment . – MANISH PATHAK Nov 14 '17 at 22:09
-
See this : https://stackoverflow.com/questions/46193204/custom-back-indicator-image-and-ios-11/47296635#47296635 – MANISH PATHAK Nov 14 '17 at 22:59
1 Answers
0
Can you try this code to solve that. Leace the comment below if it not work for you.
var backImage = UIImage(named: "back_button_image").withRenderingMode(.alwaysOriginal)
let leftPadding: CGFloat = 10
let adjustSizeForBetterHorizontalAlignment: CGSize = CGSize(width: backImage.size.width + leftPadding, height: backImage.size.height)
UIGraphicsBeginImageContextWithOptions(adjustSizeForBetterHorizontalAlignment, false, 0)
backImage.draw(at: CGPoint(x: leftPadding, y: 0))
backImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
self.navigationController?.navigationBar.backIndicatorImage = backImage
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = backImage
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: " ", style: .plain, target: nil, action: nil)

Huy Nguyen
- 77
- 1
- 12
-
i am not using custom image.its default back button of navigation bar. – Shahbaz Akram Sep 27 '17 at 08:12
-
-
Can you give mor information about that?. Even when I tried to remove all of that just keep back button with blank title, I still not reproduce that yet. – Huy Nguyen Sep 27 '17 at 15:24
-
when i push to second controller then back button of second controller allignment issue. same issue is in whole application of all controllers. Only on ios 11 . But working fine on bellow ios 11. – Shahbaz Akram Sep 28 '17 at 05:31
-
Honestly, I can not reproduce that, Can you share your source for a quick help. – Huy Nguyen Sep 28 '17 at 08:55
-
Finally i resolve issue . Select navigation bar in storyboard and then select "show the attribute inspector " and then add back button image. Otherwise no any solution found. – Shahbaz Akram Sep 28 '17 at 09:48
-
@MianShahbazAkram is there any solution without adding image on back button ? – Garry Oct 04 '17 at 07:25
-
yet not found perhaps apple will fix it in next version. I also reported to Apple. – Shahbaz Akram Oct 05 '17 at 06:19