您的位置:首页 > 其它

多个Controller之间的跳转

2015-08-03 08:43 267 查看
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];

}

SecondViewController -> RootViewController
创建一个button

[button addTarget:self
action:@selector(click:)
forControlEvents:UIControlEventTouchUpInside];

-(void)click:(UIButton *)button{

//点击返回到前一页面

[self
dismissViewControllerAnimated:YES
completion:^{

}];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: