Reputation: 862
I'm trying to create a custom transition between two views. The idea is to create the same kind of effect that the "Videos" app in the iPad and the twitter on iPhone have. Anyway, I can't find out how to perform that. I tried to use [UIView transitionWithView: ...] passing nil to options and trying to create layers in the animations block but it's not working at all. I've seen all the videos of Apple at WWDC 2010 and 2011 dealing with the subject but they never explain how to do so ! I also tried to find an answer here but there's no real explanation.
Thanks for your help.
Edit : The effect I'm trying to achieve is the one you can see here http://www.youtube.com/watch?v=SGzL658OAx4 (0:44)
Upvotes: 1
Views: 2026
Reputation: 125017
If you want a custom transition, create your own subclass of UIStoryboardSegue and override the -perform
method. See the UIStoryboardSegue reference page, particularly Subclassing Notes.
Upvotes: -1
Reputation: 1394
I don't know which effect you are talking about but here are some code to make Push transition inside a scrollView (You can make curl page transition with that code too).
-(void)performFadeTransitionTo:(GenericScreen*)newNextView
direction:(NSUInteger)direction {
CATransition *transition = [CATransition animation];
transition.duration = 0.75;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;
transition.subtype = kCATransitionFromRight;
transition.delegate = self;
[innerScroll setContentSize:newNextView.frame.size];
[innerScroll scrollRectToVisible:CGRectMake(0, 0, screenWidth, 10)
animated:NO];
[innerScroll.layer addAnimation:transition
forKey:nil];
currentView.hidden = YES;
newNextView.hidden = NO;
currentView = newNextView;
}
Upvotes: 2