3

Native back buttons are buggy on iOS 11 as shown in the picture. Is there a solution for this?

enter image description here

Community
  • 1
  • 1
Shahbaz Akram
  • 1,598
  • 3
  • 28
  • 45

1 Answers1

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