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 ...
随机推荐
- C/C++中static关键字作用总结
来来来,来看这篇文章: http://www.cnblogs.com/biyeymyhjob/archive/2012/07/19/2598815.html 总结一下: 1.先来介绍它的第一条也是最重 ...
- spring中的Log4jConfigListener作用和webapp.root的设置
转:http://blog.sina.com.cn/s/blog_7bbf356c01016wld.html 使用spring中的Log4jConfigListener有如如下好处: 1. 动 ...
- 转:从开源项目学习 C 语言基本的编码规则
从开源项目学习 C 语言基本的编码规则 每个项目都有自己的风格指南:一组有关怎样为那个项目编码约定.一些经理选择基本的编码规则,另一些经理则更偏好非常高级的规则,对许多项目而言则没有特定的编码规则,项 ...
- python和shell变量互相传递的几种方法
python -> shell: 1.环境变量 复制代码代码如下: import os var=123或var='123'os.environ['var']=str(var) #enviro ...
- Sqlserver_判断该路径是否存在该文件
declare @result int =0declare @path nvarchar(200)='d:\1.csv'execute master.dbo.xp_fileexist @path ,@ ...
- POJ 1218
题目描述看着就乐了,死板得只按着题意来写了ps: tequi是escape的方言版.. #include <iostream> using namespace std; int main( ...
- Material Design Button 样式
132down voteaccepted I will add my answer since I don't use any of the other answers provided. With ...
- Sql Server中通配符的使用
Sql Server中通配符的使用 通配符_ "_"号表示任意单个字符,该符号只能匹配一个字符."_"可以放在查询条件的任意位置,且只能代表一个字符.一个汉字只 ...
- JQUERY学习(壹)
一.jQuery的引言 1.jQuery框架:对JavaScript的封装,简化js开发 2.jQuery框架的好处: 1)语法简单 js中:document.getElementById(" ...
- 在ArcGIS 10.3标注中竖排文字
ArcGIS 10.3中文字默认“从左至右”排列,而实际的标注比如“XX路.XX街”有些文字是竖直排列的. 接着就涉及到“标注样式”的问题. 如果是整体竖排,点击图层的Properties...(属性 ...