addChildViewController
http://www.cnblogs.com/zengyou/p/3386605.html
//在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:4 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
} completion:^(BOOL finished) {
//......
}];
currentViewController=firstViewController;
//移除child view controller
// removeFromParentViewController在移除child前不会调用[self willMoveToParentViewController:nil] ,所以需要显示调用
[currentViewController willMoveToParentViewController:nil];
[currentViewController removeFromSuperview];
[currentViewController removeFromParentViewController];
addChildViewController的更多相关文章
- addChildViewController后开启热点/wifi/打电话引起的子vc的布局问题
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #00b1ff } p.p2 { margin: 0.0px 0. ...
- UIViewController中addChildViewController的作用
当在一个ViewController中添加一个子ViewController时,UI部分可以直接通过addSubView的方法添加,例如: 在一个ViewControllerA中添加ViewContr ...
- iOS 容器 addChildViewController
//在parent view controller 中添加 child view controller FirstViewController *firstViewController=[[First ...
- addChildViewController相关api深入剖析
注:本文根据个人的实践和理解写成,若有不当之处欢迎斧正和探讨! addChildViewController是一个从iOS5开始支持的api接口,相关的一系列的接口是用来处理viewcontrolle ...
- UIViewController添加子控制器(addChildViewController)
// // TaskHallViewController.m // yybjproject // // Created by bingjun on 15/10/27. // Copyright ...
- IOS笔记 : addChildViewController
一下addChildViewController,一个ViewController可以添加多个子ViewController,但是这 些子ViewController只有一个是显示到父视图中的,可以通 ...
- addChildViewController 与 addSubview
在viewcontrollerA中, 如果想把controllerB.view添加进来, 可以用 addSubview, 但如果controllerB中有个事件, 使用到 self.navigatio ...
- 【转】 iOS开发 剖析网易新闻标签栏视图切换(addChildViewController属性介绍)
原文:http://blog.csdn.net/hmt20130412/article/details/34523235 本来只是打算介绍一下addChildViewController这个方法的,正 ...
- addChildViewController 用法
// // SCMyOrderViewController.m // SmartCommunity // // Created by chenhuan on 15/9/7. // Copyright ...
随机推荐
- fibonacci 斐波那契数列
1.小兔子繁殖问题 (有该问题的详细来由介绍) 2.台阶问题 题目:一个人上台阶可以一次上一个或者两个,问这个人上n层的台阶,一共有多少种走法. 递归的思路设计模型: i(台阶阶数) ...
- spring配置详解
1.前言 公司老项目的后台,均是基于spring框架搭建,其中还用到了log4j.jar等开源架包.在新项目中,则是spring和hibernate框架均有使用,利用了hibernate框架,来实现持 ...
- 工作流学习——重要概念扫盲篇一步曲 (zhuan)
http://blog.csdn.net/zwk626542417/article/details/46592471 ***************************************** ...
- Html_页面的高度宽度等
offsetTop 指元素距离上方或上层控件的位置,整型,单位像素. offsetLeft 指元素距离左方或上层控件的位置,整型,单位像素. offsetWidth 指元素控件自身的宽度,整型,单位像 ...
- vs2010工程迁移问题,x64到Win32
ALL_BUILD:vcxproj:找不到项目文件“ALL_BUILD”中引用的平台“x64”.请确保已将该平台安装在“%VCTargetsPath%\Platforms\x64”下.无法加载项目. ...
- commonJS — 事件处理(for Event)
for Event github: https://github.com/laixiangran/commonJS/blob/master/src/forEvent.js 代码 (function(w ...
- 【转】 Linux 线程同步的三种方法
线程的最大特点是资源的共享性,但资源共享中的同步问题是多线程编程的难点.linux下提供了多种方式来处理线程同步,最常用的是互斥锁.条件变量和信号量. 一.互斥锁(mutex) 通过锁机制实现线程间的 ...
- Cmd Markdown 高阶语法手册
『Cmd 技术渲染的沙箱页面,点击此处编写自己的文档』 Cmd Markdown 高阶语法手册 1. 内容目录 在段落中填写 [TOC] 以显示全文内容的目录结构. [TOC] 2. 标签分类 在编辑 ...
- Android Support Library控件详细介绍之RecyclerView
RecyclerView控件 依赖 compile 'com.android.support:recyclerview-v7:24.1.1'RecyclerView也是容器控件,大多数的效果显示可通 ...
- SpringMVC 配置定时执行任务
1.在SpringMVC配置文件中添加 xmlns:task="http://www.springframework.org/schema/task" http://www.spr ...