Does the iPhone landscape backward display a vertical transition?

I have a regular UINavigationController and I push a series of UIViewController onto the stack. Switching to the view for the push controller - moving along the horizontal animation: [self.navigationController pushViewController: animated controller: YES];

However, when I click the "Back" button on the navigation bar, the transition animation is vertical (vertically descends down the previous controller / view).

It seems I have not found a way to make this horizontal. This only happens in landscape mode. In portrait mode, the transition occurs as a horizontal transition.

Can anyone shed some light on this?

thank

+3
source share
1 answer

I had the same problem. When I clicked back to go to the first view, I saw a vertical animation instead of the usual horizontal one.

I found an answer based on Apple NavBar sample code. I edited the sample code to add "shouldAutorotateToInterfaceOrientation" to all view controllers and made it return YES.

When I launched it, I noticed that when I clicked "Back" the correct animation was used.

FIX:

It seems you need to use your own subclassified UIViewController in the navigation controller and add shouldAutorotateToInterfaceOrientation. Presumably, the UIViewController does not return the correct orientation by default, so the wrong animation is used.

BACKGROUND:

Apple, , UINavigationController, . IB UIViewController, . , NavBar (MainViewController). Xcode UIViewController xib, Class Identity IB.

, !

+6

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


All Articles