ios ViewController 页面跳转

从一个Controller跳转到另一个Controller时,一般有以下2种:

1、利用UINavigationController,调用pushViewController,进行跳转;这种采用压栈和出栈的方式,进行Controller的管理。调用popViewControllerAnimated方法可以返回。

PickImageViewController*ickImageViewController=[[PickImageViewControlleralloc]init];

[self.navigationControllerpushViewController:ickImageViewControlleranimated:true];

[ickImageViewControllerrelease];

2、利用UIViewController自身的presentModalViewController,进行跳转;调用dismissModalViewControllerAnimated方法可以返回。

PickImageViewController*ickImageViewController=[[PickImageViewControlleralloc]init];

[selfpresentModalViewController:ickImageViewControlleranimated:YES];

//返回

[selfdismissModalViewControllerAnimated:YES];

相关推荐