//在parent view controller 中添加 child view controller
   FirstViewController *firstViewController=[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
[self addChildViewController:firstViewController]; SecondViewController *secondViewController=[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self addChildViewController:secondViewController]; ThirdViewController *thirdViewController=[[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
[self addChildViewController:thirdViewController]; [self.view addSubview:thirdViewController.view];   // addChildViewController回调用[child willMoveToParentViewController:self] ,但是不会调用didMoveToParentViewController,所以需要显示调用
[thirdViewController didMoveToParentViewController:self];
currentViewController=thirdViewController;   //切换child view controller
[self transitionFromViewController:currentViewController toViewController:firstViewController duration: options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
} completion:^(BOOL finished) {
//......
}];
currentViewController=firstViewController;   //移除child view controller
// removeFromParentViewController在移除child前不会调用[self willMoveToParentViewController:nil] ,所以需要显示调用
[currentViewController willMoveToParentViewController:nil];
[currentViewController removeFromSuperview];
[currentViewController removeFromParentViewController];

iOS 容器 addChildViewController的更多相关文章

  1. iOS 容器控制器 (Container View Controller)

    iOS 容器控制器 (Container View Controller) 一个控制器包含其他一个或多个控制器,前者为容器控制器 (Container View Controller),后者为子控制器 ...

  2. IOS笔记 : addChildViewController

    一下addChildViewController,一个ViewController可以添加多个子ViewController,但是这 些子ViewController只有一个是显示到父视图中的,可以通 ...

  3. iOS Container View Controller

    一.UIViewController 做iOS开发的经常会和UIViewController打交道,从类名可知UIViewController属于MVC模型中的C(Controller),说的更具体点 ...

  4. quickhybrid】如何实现一个Hybrid框架

    章节目录 [quickhybrid]如何实现一个跨平台Hybrid框架 [quick hybrid]架构一个Hybrid框架 [quick hybrid]H5和Native交互原理 [quick hy ...

  5. 【quickhybrid】API的分类:短期API、长期API

    前言 一切就绪,开始规划API,这里在规划前对API进行了一次分类:短期API.长期API 首先申明下,这个是在实际框架演变过程中自创的一个概念,其它混合框架可能也会有这个概念,但应该是会在原生底层来 ...

  6. Flutter 1.0 正式版: Google 的便携 UI 工具包

    Flutter 1.0 正式版: Google 的便携 UI 工具包 文 / Tim Sneath,Google Dart & Flutter 产品组产品经理 Flutter 是 Google ...

  7. 【quickhybrid】如何实现一个Hybrid框架

    章节目录 [quickhybrid]如何实现一个跨平台Hybrid框架 [quick hybrid]架构一个Hybrid框架 [quick hybrid]H5和Native交互原理 [quick hy ...

  8. 【quickhybrid】JS端的项目实现

    前言 API实现阶段之JS端的实现,重点描述这个项目的JS端都有些什么内容,是如何实现的. 不同于一般混合框架的只包含JSBridge部分的前端实现,本框架的前端实现包括JSBridge部分.多平台支 ...

  9. Flutter 1.0 正式版: Google 的跨平台 UI 工具包

    今天我们非常高兴的宣布,Flutter 的 1.0 版本正式发布!Flutter 是 Google 为您打造的 UI 工具包,帮助您通过一套代码同时在 iOS 和 Android 上构建媲美原生体验的 ...

随机推荐

  1. uC/OS-II时间(OS_time)块

    /*************************************************************************************************** ...

  2. python操作数据库

    一,安装mysql 如果是windows 用户,mysql 的安装非常简单,直接下载安装文件,双击安装文件一步一步进行操作即可. Linux 下的安装可能会更加简单,除了下载安装包进行安装外,一般的l ...

  3. js日期加减

    先补充下基础知识: var myDate = new Date(); //myDate默认返回当前时间 myDate.getYear(); //获取当前年份(2位) myDate.getFullYea ...

  4. Log4j、slf4j

    1.Log4j 1.1 Log4j简介 Log4j有三个主要的组件:Loggers(记录器),Appenders (输出位置)和Layouts(布局).这里可简单理解为日志类别,日志要输出的地方和日志 ...

  5. Reading With Purpose: A grand experiment

    Reading With Purpose: A grand experiment This is the preface to a set of notes I'm writing for a sem ...

  6. bootloader

    1) C# 为了给设备升级固件,在前同事的基础上改了下,在.NET Framework下写的. 2)Tera Term + ttl 上面.NET平台的运行文件虽然小巧,但是依赖.NET Framewo ...

  7. sufeinet

    http://www.sufeinet.com http://tool.sufeinet.com/

  8. sql之truncate 、delete与drop区别

    sql之truncate .delete与drop区别相同点:truncate 和不带 where 子句的 delete,以及 drop 一定会删除表内的数据不同点:1. truncate 和 del ...

  9. centos 7.0 ln命令 和chkconfig 命令介绍 开机自动启 服务

    有时候centos需要 程序开机启动的时候  自启动 首先在 /etc/init.d/ cd /etc/init.d 文件夹下建立开机启动项 使用ln命令 使用方式 : ln [options] so ...

  10. iOS项目重命名以及Xcode修改Scheme名称图文详解 (yoowei)

    在iOS开发中,有时候想改一下项目的名字,都会遇到很多麻烦.温馨提醒:记得备份. 看到项目名称,总感觉有点low,所以尝试着要将其更改一下. 项目原结构如下: 更改后的项目结构如下: 下面开始更改操作 ...