
pushViewController
一般在UINavigationController的时候用,
[self.navigationController pushViewController:viewController animated:YES];
返回之前的视图是:
[self.navigationController popViewControllerAnimated:YES];
push以后会在navigation的left bar自动添加back按钮,它的响应方法就是返回。所以一般不需要写返回方法,点back按钮即可。
presentViewController
其它时候使用presentViewController,
[self presentViewController:viewController animated:YES completion:nil];
返回之前的视图是:
[self dismissViewControllerAnimated:YES completion:nil];
附加
使用presentViewController,从A->B->C,从C直接返回A。
1 2 3 4 5 |
|
1 2 3 4 5 6 7 8 |
|




近期评论