Warm tip: This article is reproduced from stackoverflow.com, please click
ios swift

After setting backIndicatorImage, how to reuse the system's back icon?

发布于 2021-02-13 02:10:57

I wrote the following code and set a custom back button icon:

let navigationBar = UINavigationBar.appearance()

navigationBar.backIndicatorImage = image
navigationBar.backIndicatorTransitionMaskImage = image

It works, which is good.

But now in another controller, I want to reuse the system’s back button icon.

I have tried the following in the new controller:

  1. Set backIndicatorImage and backIndicatorTransitionMaskImage to nil.
  2. navigationItem.backBarButtonItem = nil

But this doesn't work.

My application needs to support iOS 10, so I cannot use SF Symbol.

What should I do?

Questioner
Rakuyo
Viewed
0
Rakuyo 2020-11-05 11:52

I found the answer to this problem, and still set backIndicatorImage and backIndicatorTransitionMaskImage to nil.

But I used to set up on the current controller, the correct way should be set up on the upper controller.