I am using a UIViewController and I use presentModalViewController:controllerr animated:YES to present it but I would like if it would slide down from the top of the screen instead of up from the bottom, any way to do this?
I created a function for pushing the ViewControllers
from all 4 directions:
- (void) slideLayerInDirection:(NSString *)direction andPush:(UIViewController *)dstVC {
CATransition* transition = [CATransition animation];
transition.duration = 0.5;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = direction;
[self.view.layer addAnimation:transition forKey:kCATransition];
[self pushViewController:dstVC animated:NO];
}
The header file contains the following:
#import <QuartzCore/QuartzCore.h>
#define direction_left kCATransitionFromLeft
#define direction_top kCATransitionFromBottom
#define direction_right kCATransitionFromRight
#define direction_bottom kCATransitionFromTop