0

The pushed controller cross over current controller.

Results are as follows: enter image description here image 0

Actually, I have hook into this app, it use a subclass named MMUINavigationController, and I am sure current action is "pushViewController:animated:", it's the interface I hooked.

Tweak.xm: enter image description here image 1

alertView: enter image description here image 2

how to make it ?

additional,standar animation:

enter image description here

image 3

navigation bar of pushed controller

5

image 4

ccnyou
  • 337
  • 2
  • 11

1 Answers1

1

Here's one solution:

  1. hide the navigation bar of the navigation controller
  2. add a navigation bar to the root view controller of the navigation controller
  3. restore the swipe to back gesture to the navigation controller

For the last point you can add a pan gesture recognizer (suggested) or simply set the interactivePopGestureRecognizer's delegate of the navigation controller to nil:

self.navigationController?.interactivePopGestureRecognizer?.delegate = nil;

but please refer to this discussion for its implications: No Swipe Back when hiding Navigation Bar in UINavigationController

EDIT:

Working solution which fulfills the requirements: just setting the navigationBarHidden in the viewWillAppear does the magic.

I've setup a sample demo here: https://github.com/ldantona/NavigationBarExample

EDIT 2:

Just found this library, could it be of any help? https://github.com/MoZhouqi/KMNavigationBarTransition

The library can capture the background style of the navigation bar in the disappearing view controller when pushing, and when you pop back to the view controller, the navigation bar will restore the previous style, so you don't need to consider the background style after popping. And you also don't need to consider it after pushing, because it is the view controller to be pushed that needs to be considered.

Hope it helps

Community
  • 1
  • 1
DAN
  • 919
  • 1
  • 6
  • 23
  • In image 3, left controller share one navigation bar with pushed controller. Can this solution make it ? – ccnyou Mar 15 '16 at 10:05
  • No, as far as I know with this solution you have to manually add a navigation bar to each view controller – DAN Mar 15 '16 at 10:56
  • such a sadly story – ccnyou Mar 15 '16 at 10:57
  • see image 1, the left back button "< 返回" also have gradient effect. Slowly change to "< 微信" – ccnyou Mar 15 '16 at 15:32
  • actually it works exactly like that (I've updated the sample project to show it between the first two view controllers) – DAN Mar 15 '16 at 15:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/106377/discussion-between-dan-and-ccnyou). – DAN Mar 15 '16 at 15:50
  • Maybe it use a fake navigationBar on pop and set backgroundImage of poping navigationBar to clear color. See image of discuss. – ccnyou Mar 17 '16 at 16:33