0

I ran into a transition problem today. It's hard to explain to I recorded a very short clip. I want the first transition (when I click on the + button) to look exactly like the second one (when I click on

Here's the clip:

transition clip

this is my code :

My Source Code

user3797431
  • 393
  • 1
  • 5
  • 15
  • do you want the first animation to show first view while animating instead of Black Screen ? – Asif Mujteba Jul 24 '14 at 09:11
  • @asifmujteba I want when execute my animation to be like back button animation if you looking my clip understand my purpose. I want when execute my animation second view moving left to right and my first view don't move!!! – user3797431 Jul 24 '14 at 09:26
  • This might help you: http://stackoverflow.com/questions/7663707/customise-uinavigationcontroller-animation-catransition – Asif Mujteba Jul 24 '14 at 10:35

1 Answers1

0

How are you doing it now then? You didn't give a lot of info but you're using a navigation controller right? Do you need to? One option is to present the second screen from the first. In that case you handle the transitions yourself and you could even give the two view controllers a common base class if several components (like the + sign) are common to both. I have some code I can post if that might be useful...

To present and dismiss a vc:

Have a second view controller as a property in your root view controller:

@property (nonatomic, strong) UIViewController *secondViewController;

in the button pressed method for your plus button:

[self presentViewController:_secondViewController animated:YES completion:nil];

in your presented view controller, in the button pressed method for your back button:

[self dismissViewControllerAnimated:YES completion:^{
}];

Also, if you want to slide horizontally as in this case you'll need to do some custom animation, by creating an animator object that is a UIVIewControllerAnimatedTransitioning delegate. I recommend you read up on that - I also have some examples of that for you if you wish.

Cheers.

sinewave440hz
  • 1,265
  • 9
  • 22
  • my friend do you help my code? do you want look at my code and tell me my mistake??? – user3797431 Jul 24 '14 at 08:40
  • Ok. One way to do it is as I indicated, to present a view controller from your root view controller. So your root view controller can be any uiviewcontroller, it doesn't need to be a navigation view controller. It just needs a button - in your example a plus button. You could use a toolbar, it depends on whether or not you need any other functionality in the top bar other than the button. If not, a button and a bar background will do. So in the button pressed method you need to present your second view controller, which can be very similar to your root vc. Will edit my answer now... – sinewave440hz Jul 24 '14 at 14:47