码迷,mamicode.com
首页 > 其他好文 > 详细

两个页面之间的动画跳转。

时间:2014-10-10 15:10:00      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   ar   for   文件   sp   

 

接触到了两个页面之间的跳转带动画的。效果还不错。

 

一,先上项目总体图。

 

bubuko.com,布布扣

 

二,上代码。

 

AppDelegate.m文件

 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    
    FirstViewController *firstView=[[FirstViewController alloc]init];
    UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:firstView];
    self.window.rootViewController=nav;
    
    
    
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

 

FirstViewController.m文件

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title=@"FirstVC";
    self.view.backgroundColor=[UIColor redColor];
}
//点击页面任何处跳转到页面二
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    SecondViewController *secondVC=[[SecondViewController alloc]init];
    
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.9];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
    [self.navigationController pushViewController:secondVC animated:NO];
    [UIView commitAnimations];
    
}

 

SecondViewController.m文件

 

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title=@"SecondVC";
    self.view.backgroundColor=[UIColor blueColor];
}

 

两个页面之间的动画跳转。

标签:style   blog   http   color   io   ar   for   文件   sp   

原文地址:http://www.cnblogs.com/yang-guang-girl/p/4015654.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!