pushviewcontroller和presentviewcontroller区别

1.用UINavigationController的时候用pushViewController:animated

----返回之前的视图[[self navigationController] popViewControllerAnimated:YES];

---ps:push以后会在navigation的left bar自动添加back按钮,它的响应方法就是返回。所以一般不需要写返回方法,点back按钮即可。

2.其他时候用presentModalViewController:animated

[self presentModalViewController:controller animated:YES];//YES有动画效果

-----返回之前的视图    [self dismissModalViewControllerAnimated:YES];

你可能感兴趣的:(pushviewcontroller和presentviewcontroller区别)