UINavigationController Push Segue - Strange animation - iphone

I have a UINavigationController which was created in Storyboards, and connected with push segues for each view controller. However, when I click "next" (which activates the push segue), then animation going forward is strange. (See: https://www.youtube.com/watch?v=0cFo9sUtBeM). Going back (Selecting the root controller of the UINavController in the UITabBarController) has the correct animation though. Any ideas why this could be?
Edit: the boxes in the video are added by me to protect client identity. The animation issue detailed is the slide animation which appears to come from the top right (or top left for the 'next' button).

It appears that setting a different Prompt for the navigation bar on the second view controller causes this weird animation effect. After removing the prompt, the animation now works as expected.

It looks like a navigation controller push and a modal transition. If I had to wager, I'd guess you have a modal transition hooked up to the button in storyboard, and code in the action method for the button doing a pushViewController:animated: on self.navigationController - (either that or the other way around, with a push hooked up in storyboard).
If that's the case, start by commenting out any button action code (any target/selector you setup in code, or any IBAction you setup in storyboard for that button).

I also recently had this problem using a Master Detail storyboard with an embedded Navigation Controller. The issue was fixed when I changed the Background of the View of the Detail screen from Default to a different color. I found it did not make any difference which color as long as it was not Default. I hope that this helps someone.

Related

Segue from tab bar viewController to ViewController not working correctly

I have an app in Xcode controlled by a Tab Bar View Controller and on the first View, I have a button that I want to Modally segue to a separate popup ViewController. However, when I hit the button in the app, the tab bar turns white and the app becomes completely unresponsive. As far as I can tell everything is setup correctly in the code and in the Main.storyboard. I need to fix this issue!
I've tried adding a segue in the storyboard, and I've also tried setting up the segue in the attached swift file. Neither work and provide the same result every time.
Xcode screenshot
What it looks like when the button is tapped

Storyboard, where to drag connection from one view controller to the next

I'm confused on how storyboarding works.
So I created a simple app where the root view controller is a navigation controller.
I dragged a button to the the rootViewController of the NavigationController.
I dragged another view controller onto the screen, made it's background orange, and made it a subclass of OrangeViewController.
I dragged a connection from the status bar area of my rootViewController to the OrangeViewController.
I made this Segue Push and called it ShowOrange.
I created an action for my button that has:
- (IBAction)push:(id)sender {
[self performSegueWithIdentifier:#"ShowOrange" sender:self];
}
That's all it does. So when I press the button, it does show OrangeViewController. Then when I press back however, it keeps my background Orange. The title does change to ViewController, and there is no back button, but the background is orange. I was wondering why it does this?
My other question is a generic question with dragging segues. I seem to be able to drag it from the button itself, or the status bar. Is there a difference? What is really happening when that connection is made? Thanks.
Edit: Picture included
This particular answer is just for your second question:
Dragging from the button is analogous to setting that button's action to be performing the segue. Dragging from the view controller object (which is what I think is happening when you drag from the 'status bar', and would also happen if you dragged from the view controller while more zoomed out, or from the view controller in the list view), you are just setting it up to be used in code (in this case, it must have an identifier. The button segue does not need an identifier).

UIToolbar push view issue

I've created a UIToolbar and added it as a subview of the navigationController. The problem is it doesn't disappear when I do push so I hide it on push but the makes it just disappear which makes it look tacky. I thought about animating it but I am finding it hard for the animation to be exactly like the push and pop animation for the navigation controller.
Does anyone know the push and pop animation properties so it can be exactly the same, or does anyone know what view or what property i can do to push and pop the toolbar with the navigation controller.
As a note I also tried to use the toolbar that comes with the navigationController but the buttons were disappearing after popping back to the view.
Yup, check out the hidesBottomBarWhenPushed property of the UIViewController that you are push/popping.

iPhone landscape navigation back action shows vertical view transition?

I have a regular UINavigationController and I push a series of UIViewController into the stack. The view transition for push controller is horizontal animation transition:
[self.navigationController pushViewController:controller animated:YES];
However, when I press the Back button on the navigation bar, the view transition animation is vertical (vertically dropping down the previous controller/view).
I don't seem to find any way to make this horizontal. This happens only in Landscape mode. Portrait mode the transition all happens as horizontal flip transition.
Can anyone shed any light on this?
Thanks
I had the same problem. When I pressed back to get to the first view I saw a vertical animation instead of the normal horizontal one.
I found an answer based on Apple's NavBar sample code. I edited the sample code to add "shouldAutorotateToInterfaceOrientation" to all the view controllers, and made it return YES.
When I ran it I noticed the correct animation was used when pressing "Back".
FIX:
It seems like you need to use your own subclassed UIViewController within the navigation controller, and add shouldAutorotateToInterfaceOrientation. Presumably the default UIViewController isn't returning the correct orientation so the wrong animation is used.
BACKGROUND:
I checked all the differences between my code and Apple's, and I found out that my navigation controller was a subclass of UINavigationController, where I perform all the work. By default IB had added a UIViewController inside this, and I left it alone. I noticed that the NavBar sample code had its own class set (MainViewController). So I made Xcode create a new UIViewController subclass with no xib, then set it up in the Class option in the Identity panel in IB.
I hope this makes sense and helps!

How do you use Interface Builder to control UINavigationControllers properly?

I have been in the process of learning to build iPhone applications for the last two weeks. I've gotten through a fair amount of content, and now I'm trying to create a modal pop up with presentModalView.
I can can successfully create and slide up a view, but I notice that modal views don't provide you with a default navigation bar at the top of the window, which makes sense for flexibility I guess. Most modal views I've seen have a "Cancel" and a "Done" or "Save" button as navigationItems on what looks to be a UINavigationController. My thought then was just to instantiate a navigation controller and push the single view onto the view controller stack, and presentModalView:navController.view ...
Because the view is relatively complex, I was trying to lay out both the UINavigationController, with the bar buttons, and the view I was hoping to push onto the stack in a single xib -- no matter what I try, I can't seem to get the linkages correct. Can you even do this? Or should I create a separate class/xib for the view I'm going to be pushing onto the navigation controller? Seems like a lot of classes and files for one screen, so my feeling is I must be missing something.
At this point, I could have done it programmatically about an hour and a half ago... however, this is a real nag, since IB seems GREAT for some things. Anyone have an experience with a situation like this?
Thanks,
Josh
If you're not going to use this new XIB for navigation, there's no point in making a navigation controller.
In interface builder, simply drag a UINavigationBar to the top of your view, and add a "Done" Button. Now, add an IBAction to the done button to dismiss the view controller. Your ViewController code for the dismiss IBAction should look something like this:
-(IBAction)dismiss {
//Any logic before dismissing the modal view
[super dismissModalViewControllerAnimated:YES];
}