Transition of a view controller embedded in a navigation controller - ios

I have a problem with a transition. I am modifying this project https://github.com/xxxAIRINxxx/MusicPlayerTransition in order to have the transition from the right instead of the bottom. This part is fine. My transition comes from the right.
My problem is that I'm embedding the presented modal view controller into a Navigation Controller. I do this so I can use the "pushViewController" function when I click on a cell of my modal view controller.
My hierarchy is as follow. I have a dashboard. From the right, I drag a TableViewController X. If I drag back in the opposite direction, I come back to my dashboard. Fine. Now, If I tap a cell, it pushes a new ViewController Y.
Now, if I am in my new ViewController Y and that I drag back, I come back directly on my dashboard instead of going back to my TableViewController X, as a natural navigation controller should behave.
I did a small project on github that does only that, so you can easily see my entire code.
https://github.com/magohamote/NavigationControllerTransition.git
I understand why it behaves like this, but I would like to know how I can override the transition set on the navigation controller in order to have the normal behaviour of my navigation controller once it is presented.
Another problem I have not been able to solve. On the project I used as a starter (the one from xxxAIRINxxx) the transition is perfectly smooth. On mine, the first time I trigger the transition, it blinks and get stuck. Once I did it once, it is smooth the next time I drag my view. But the first time is always awful. I don't know why either :(
Thank you a lot for your help!

Related

For swift iOS app dev, how do I segue to a view that takes up part of the screen only?

GroupMe is a good example. I want to implement something similar to this..
when you press the top left icon it'll bring you to the view on the left hand side, and when you click the right hand side of that view (the chats) it will bring you back
As the documentation says:
Use segues to define the flow of your app’s interface. A segue defines
a transition between two view controllers in your app’s storyboard
file. The starting point of a segue is the button, table row, or
gesture recognizer that initiates the segue. The end point of a segue
is the view controller you want to display. A segue always presents a
new view controller, but you can also use an unwind segue to dismiss a
view controller.
As said by Apple© segues are for changing View Controllers only and cannot be used to move single views. I suggest using animations to achieve the effect you are searching, however segues are definitely not what you are looking for. Maybe this question on stackoverflow.com may help you.
And please be sure to check for information by yourself first, I got this information in less than 5 minutes by searching on Google.com.
Regards -Jorge

Proper way to segue between two simple View Controllers in iOS 7

I'm mainly from a C# background, so the workflow for iOS is a bit unusual for me, at least for now.
I was having a problem having simple segue from a main menu, to a another menu/work area, and then with the ability to go back to the main menu.
For a test, apparently I did something wrong.
I didn't write any code for this test to exhibit the problem.
What I did was just,
create a new single-view app
drag an additional view controller onto the work area
drag the start arrow to the new view controller (so it becomes the initial view, same thing as checking the checkbox to set it as the initial view)
added a button to each view controller
Ctrl + clicked and dragged the buttons to the opposing view
for the segue type, I chose "replace"
now the program crashes if I hit the second button to go back to the "main menu" (green view controller in this example)
So what am I doing wrong? Do I need to add some form of delegate or something?
I did find this, though it present fewer segue options in the tutorial than what I have.
https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html
These are the options I have when I Ctrl + Click from a button to another view
-Push
-Modal
-PopOver
-Custom
-Replace
"Have you embedded a navigation controller? You need to go to editor->embed in-> Navigation Controller. You need a navigation controller for push segue. – Kaushal Bisht"
This solved it for me. Now I'm just going to work on replacing the navigation bar with custom UI controls.
Thanks everyone! :)

Custom segue from left to right for form sheets (iPad)

I have some view controllers in a form sheet and right now they all push segue. But I want to make an animation that makes them come from right to left during segue throughout the page. so when I go to the next view controller my segue should start bringing the view controller from the right and the parent view controller starts to move to the left and goes off the screen/fades and the child view controller comes from right and settles at the center of the iPad like how form sheets do. I was wondering if anyone had implemented something like that before? if not, can I get some suggestions in how to do this so that I can get a head start? I have just have a little experience with custom segues, where I could use QuartzCore to animate the view controllers and since they all belong to the same navigation controller I am not sure how can I achieve this fly from right to center and to left animation.
You can create your own full-sized view controller and emulate form sheet's behavior inside it by yourself (with gesture recognizers etc)

Weird segue transition after disabling autolayout

I don't know how to explain this, it's really strange.
Ok think about two view controllers, the first one is a tableview controller and has a button in his navigation bar connected via push segue to the second view controller.
When pushing the button, the second view controller comes in from the right and at the same time pushes the first view controller out, to the left.
I wasn't using auto layout for my project but I've activated it to test something (I've just activated two constraints for two labels in the prototype cell). Then I've disabled the auto layout and now when I push the button on the first controller the second one comes in, but instead of pushing out the first controller, it slides on the back of the first one, that disappears only when the animation ends.
It's like if all the cells in my first controller become transparent during the transition.
I can't see anything strange in my settings so I don't know how to solve this.
Well, as Ryan said, it was one of those annoying problems where you dig around for 30 (for me it's been 90) minutes with no success and then find out how to fix it with a single click.
It turns out that the second view controller had a transparent background (don't know why), so reverting it to white solved the problem.
Thanks God I din't delete the storyboard to make it ex-novo.

Data disappears when switching between view controllers

I am writing an iPhone application using the storyboards for an initial mockup. The problem I have right now is switching view controllers.
I have a table view controller and another view controller. All I want to do is use a back button to go back to the original screen, and I can do that, except the data disappears. The storyboard that I have is shown below.
I have the Back button going back to the original navigation controller. I have also had it going back to the Card view controller.
I have hard coded some example cells to just see how things look and they show up just fine when I run the simulation. When I click the back button though, it goes back to the All Cards screen and the cells that were there are now gone.
If I need to post some code just ask for what part would be helpful, I have done all of this through storyboards though.
I'm sure it's something stupid I've done, any point in the right direction would be greatly appreciated.
Basically: you pushed where you should have popped.
What you are seeing on the Storyboard does not exist yet. By segue-waying during runtime to a view controller it gets instantiated.
When you segue-wayed during runtime from the Add Card view controller "back" to the Card View Controller - here is what happened: instead of popping the navigation stack all the way back to the Card View Controller you already had, you just instantiated a new Card View Controller and pushed it onto the navigation stack. You could verify that by going all the way back to the original Card View Controller by tapping the back button several times.
What you could do to accomplish your task is this:
Instead of using the Storyboard for your back button use an IBAction in code:
- (IBAction)popToRoot:(id)sender {
[self.navigationController popToRootViewControllerAnimated:YES];
}

Resources