Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View appears with modal view animation instead of show (push) animation

Tags:

ios

swift

swift2

I've recently updated my app from iOS 8.3 to iOS 9. After fixing the various errors with the code, I managed to compile the app and run it, when I noticed the following problem.

When I perform a segue clicking, for example, an UIButton, the view loaded with the segue appear with the animation of a modal view (sliding from bottom until it reaches top), but in the storyboard the segue is Show (e.g. Push). In addition, the back button from the navigation controller doesn't appear anymore.

The console print this when I perform a segue:

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7ffde14866b0>)

The problem seems to be present only in a view, when loading other views, I tried to set other views as Initial View Controller and all works.

like image 495
QUB3X Avatar asked Jun 23 '15 14:06

QUB3X


People also ask

How do I change the view controller in Swift?

Add a button on the current screen. Then press control and drag the button to the target screen. Then select push. And when you will tap the button the screen will be switched to the target screen.

How do I change the view in Xcode?

Right-click the control or object in your current view controller. Drag the cursor to the view controller you want to present. Select the kind of segue you want from the list that Xcode provides.


1 Answers

After taking a look at the Storyboard in the project, I discovered that the problem was due to extra navigation controllers after each Push segue. That is, in addition to the initial (root) navigation controller, the Storyboard contained a UINavigationController as the destination for the problematic Push segues. Removing these extra navigation controllers (but keeping the root navigation controller) solved the problem.

like image 182
ndmeiri Avatar answered Nov 08 '22 07:11

ndmeiri