1.首先创建一个RootViewController和一个SecondViewController
在RootViewController.m里引头文件
RootViewController ->SecondViewController
写一个Button,给Button添加一个Click方法
[button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
-(void)click:(UIButton *)button
{
//创建一个secondVC的对象
SecondViewController *secondVC=[[SecondViewController alloc] init];
//设置一下跳转时候的动画效果
[secondVC setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
//进行跳转
[self presentViewController:secondVC animated:YES completion:^{
}];
//内存管理
[secondVC release];
}
[button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
-(void)click:(UIButton *)button{
//点击返回到前一页面
[self dismissViewControllerAnimated:YES completion:^{
}];
}