Show UINavigationBar feedback button without pressing view controller

In the iPad Photos app, when you click on an album, the image stack expands to fill the screen — you are in the same view, it rebuilt the grid a bit. But at the top, the back button appears in the "left arrow" style, as if using a pushViewController, except that it disappears neatly and does not slip. When you press it, it disappears again, not pops up.

Is there any way to reproduce this behavior? I have tried several options so far, and might just miss something. What I tried:

  • Setting self.navigationItem leftBarButtonItem works, but gives me a square button, not a corner Back-style one - there are several hacks on the Internet to do this work, for example, using pictures for the button, d, but only use them if definitely not " the official "way to do it.

  • Setting self.navigationItem.backBarButtonItem - this is usually used to configure the back button when you click on the view controller, so it has no effect.

  • [self.navigationController.navigationBar setItems ::] - this works, although it gives me a moving animation, not a fade. As a result, I use animated: NO to make it appear. Downside: When you click "Back" you get a sliding animation that looks weird because the rest of the user interface remains stationary.

Has anyone been able to reproduce this effect?

Thanks in advance!

+3
source share
2 answers

Your first approach is probably the best.

-, UIButton backgroundImageForState: titleForState: ( ..), UIButton customView UIBarButtonItem.

, . resizableImageWithCapInsets: ( stretchableImageWithLeftCapWidth:topCapHeight:, iOS , 5.0), , , , , UIButton, .. , UIBarButtonItem.

0

, .

"" , pushNavigationItem:animated: popNavigationItemAnimated: UINavigationBar. "". , , , , , .

iOS 7 API , -, navigationController:animationControllerForOperation:fromViewController:toViewController: UINavigationControllerDelegate. .

, UICollectionViewController, useLayoutToLayoutNavigationTransitions, - , .

0

Source: https://habr.com/ru/post/1770908/


All Articles