---
title: "视图切换的方式"
author: "wangleyiang"
date: "2013-11-01T15:59:24Z"
tags: []
categories: ["移动开发"]
slug: "untitled"
draft: false
lastmod: "2013-11-01T15:59:24Z"
id: 1968378
url: "https://wangleyiang.iteye.com/blog/1968378"
---

**1、利用NavigationController切换**

切换：

 

```
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
```

 返回：

```
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
```

 

**2、覆盖View达到切换效果**

切换：

```
- (void)addSubview:(UIView *)view;
```

返回：

```
- (void)removeFromSuperview;
```

 

**3、利用Present系列方法**

切换：

```
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion NS_AVAILABLE_IOS(5_0);
```

 返回：

```
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion NS_AVAILABLE_IOS(5_0);
```

 

以上仅是部分方法，当然还有其它方式！：）