Skip to content

Using generic UIViewControllers is fine#2

Open
lluisgerard wants to merge 1 commit intohightech:masterfrom
lluisgerard:patch-1
Open

Using generic UIViewControllers is fine#2
lluisgerard wants to merge 1 commit intohightech:masterfrom
lluisgerard:patch-1

Conversation

@lluisgerard
Copy link
Copy Markdown

Simplified the code using generic UIViewControllers. There is no need to use your own classes here for MainView and SecondaryViews.

I also changed the duration so it uses the same you set on transitionDuration.

BTW, Thanks for this example, it really helped me :)

Simplified the code using generic UIViewControllers. There is no need to use your own classes here for MainView and SecondaryViews.

I also changed the duration so it uses the same you set on transitionDuration.

BTW, Thanks for this example, it really helped me :)
@KeiroMidori
Copy link
Copy Markdown

Thank you for your help, thanks to you I was able to animate the show of my second view controller :)
But I have a simple question. How can I change the transition animation style ? Get a Dissolve animation instead of CoverVertical for exemple.

Thank you very much for your answer !!!

@lluisgerard
Copy link
Copy Markdown
Author

@KeiroMidori right now the animation is separated in two states:
[toVC.view setFrame:CGRectMake(0, screenRect.size.height, fromVC.view.frame.size.width, fromVC.view.frame.size.height)];
And inside the animation block:
[toVC.view setFrame:CGRectMake(0, 0, fromVC.view.frame.size.width, fromVC.view.frame.size.height)];

This is just setting the frame outside the screen to inside the screen. The animateWithDuration does all the magic from first state to the second state.

You could comment these two lines and play with toVC.alpha, maybe setting it to 0 first and to 1 inside the animation block. I haven't tried it but it should work this way.

@KeiroMidori
Copy link
Copy Markdown

It works ! But when I try to dismiss it with the CrossDissolve transition animation it makes a little flash on screen, maybe because it's too fast. I don't know how to make a dismiss dissolve animation manually.

@lluisgerard
Copy link
Copy Markdown
Author

@KeiroMidori uhm... interesting... maybe you should set the alpha 0 to the view in another place.
How do you dismiss the viewController? I just checked my project and I'm not using the transition on dismiss, only when it appears and I'm using [self dismissViewControllerAnimated:YES completion:nil]; to dismiss it. Not sure then, if you should create an animateTransition separated method for dismissing it, that just sets the alpha to 0 inside the animation block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants