大学IT网 - 最懂大学生的IT学习网站! QQ资料交流群:367606806
当前位置:大学IT网 > IOS技巧 > 两个页面之间的动画跳转。

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

关键词:跳转两个页面动画  阅读(825) 赞(16)

[摘要]本文是对两个页面之间的动画跳转。的讲解,对学习IOS苹果软件开发有所帮助,与大家分享。

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

一,先上项目总体图。

二,上代码。

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];
}


相关评论