views:

20

answers:

0

Hello,

I've implemented two different transition techniques to try with my app, one button for each one. I use presentModalViewController:myView for the first button and CATransition on the second.

The ModalView one works but my CATransition has a bug: it slides the entire view a little off screen, as shown in pictures, with a white frame at the bottom equal to the status bar height. The ModalView doesn't do this and when i use the ModalView to change view, then go back and try the CATransition, the bug is gone!

I use a separate ViewController.h and .m for each view, and a single .nib-file ViewController.xib with multiple views and view controllers added to provide the different "pages".

Please help me out!

- (IBAction) tillUndervy1funktion {
    [self presentModalViewController:franvaro animated:YES];

}

- (IBAction)switchToUnderVy1
{
// get the view that's currently showing
UIView *currentView = self.view;
// get the the underlying UIWindow, or the view containing the current view view
UIView *theWindow = [currentView superview];

// remove the current view and replace with myView1
[currentView removeFromSuperview];
[theWindow addSubview:franvaro2];

// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

[[theWindow layer] addAnimation:animation forKey:@"SwitchToUndervy1"];

}