ios containerViewController
- (void)replaceViewController:(UIViewController *)existingViewController withViewController:(UIViewController *)newViewController inContainerView:(UIView *)containerView completion:(void (^)(void))completion
{
// Add initial view controller
if (!existingViewController && newViewController) {
[newViewController willMoveToParentViewController:self];
[newViewController beginAppearanceTransition:YES animated:NO];
[self addChildViewController:newViewController];
newViewController.view.frame = containerView.bounds;
[containerView addSubview:newViewController.view];
[newViewController didMoveToParentViewController:self];
[newViewController endAppearanceTransition];
if (completion) completion();
}
// Remove existing view controller
else if (existingViewController && !newViewController) {
[existingViewController willMoveToParentViewController:nil];
[existingViewController beginAppearanceTransition:NO animated:NO];
[existingViewController.view removeFromSuperview];
[existingViewController removeFromParentViewController];
[existingViewController didMoveToParentViewController:nil];
[existingViewController endAppearanceTransition];
if (completion) completion();
}
// Replace existing view controller with new view controller
else if ((existingViewController != newViewController) && newViewController) {
[newViewController willMoveToParentViewController:self];
[existingViewController willMoveToParentViewController:nil];
[existingViewController beginAppearanceTransition:NO animated:NO];
[existingViewController.view removeFromSuperview];
[existingViewController removeFromParentViewController];
[existingViewController didMoveToParentViewController:nil];
[existingViewController endAppearanceTransition];
[newViewController beginAppearanceTransition:YES animated:NO];
newViewController.view.frame = containerView.bounds;
[self addChildViewController:newViewController];
[containerView addSubview:newViewController.view];
[newViewController didMoveToParentViewController:self];
[newViewController endAppearanceTransition];
if (completion) completion();
}
}
ios containerViewController的更多相关文章
- iOS 生命周期
应用生命周期 App启动:当App启动时,首先由not running状态切换到inactive状态,此时调用application:didFinishLaunchingWithOptions: ...
- 自定义视图控制器切换(iOS)
在iOS开发过程中,通常我们会使用UINavigationController,UITabbarController等苹果提供的视图控制器来切换我们的视图.在iOS5之前,如果要自定义容器视图控制器很 ...
- iOS开发无第三方控件的援助达到的效果侧边栏
最近的研究iOS程序侧边栏.渐渐的发现iOS该方案还开始采取风侧边栏格该,QQ,今日头条,Path(Path运营商最早的侧边栏app该,效果说成是Path效果),所以就研究了下. 然后发现Git Hu ...
- 一步步构建iOS路由
什么是移动端路由层: 路由层的概念在服务端是指url请求的分层解析,将一个请求分发到对应的应用处理程序.移动端的路由层指的是将诸如App内页面访问.H5与App访问的访问请求和App间的访问请求,进行 ...
- 分享一下自己ios开发笔记
// ********************** 推断数组元素是否为空 ********************** NSString *element = [array objectAtIndex ...
- iOS可视化动态绘制连通图
上篇博客<iOS可视化动态绘制八种排序过程>可视化了一下一些排序的过程,本篇博客就来聊聊图的东西.在之前的博客中详细的讲过图的相关内容,比如<图的物理存储结构与深搜.广搜>.当 ...
- 【疯狂造轮子-iOS】JSON转Model系列之二
[疯狂造轮子-iOS]JSON转Model系列之二 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇<[疯狂造轮子-iOS]JSON转Model系列之一> ...
- 【疯狂造轮子-iOS】JSON转Model系列之一
[疯狂造轮子-iOS]JSON转Model系列之一 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 之前一直看别人的源码,虽然对自己提升比较大,但毕竟不是自己写的,很容易遗 ...
- iOS总结_UI层自我复习总结
UI层复习笔记 在main文件中,UIApplicationMain函数一共做了三件事 根据第三个参数创建了一个应用程序对象 默认写nil,即创建的是UIApplication类型的对象,此对象看成是 ...
随机推荐
- ThinkPHP之中的验证码的小示例
ThinkPHP之中已经封装好了验证码的调用,但是关于手册,缺失了HTML之中以及.实际操作之中的点击ajax就会刷新验证码ajax代码:现在分享一下:看客老爷们注意啦! 放大招啦!!!三分归元气-- ...
- PopupWindow的简单使用
测试代码: package com.zzw.testpopuwindows; import android.app.Activity; import android.graphics.Color; i ...
- 7)Java数据类型
Java中的数据类型分为基本数据类型和引用数据类型: 1)基础数据类型有: boolean, byte.short.char, int.float.long, dou ...
- 解决vmware安装 win7 后 没有虚拟网卡驱动 不能上网的问题
项目需要用到win7 32位系统,于是装个虚拟机,换了好几个系统资源,都是没有网卡驱动, XP 2003 都能上网唯独WIN7 不行,安装vmware tools也不管用,终于找到了这个东西.vmwa ...
- 生日蛋糕 (codevs 1710) 题解
[问题描述] 7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体. 设从下往上数第i(1<=i<=M)层蛋糕是半径为Ri,高度为Hi的圆柱 ...
- 十天学会单片机Day1点亮数码管(数码管、外部中断、定时器中断)
1.引脚定义 P3口各引脚第二功能定义 标号 引脚 第二功能 说明 P3.0 10 RXD 串行输入口 P3.1 11 TXD 串行输出口 P3.2 12 INT0(上划线) 外部中断0 P3.3 1 ...
- linux MTD系统解析(转)
MTD,Memory Technology Device即内存技术设备,在Linux内核中,引入MTD层为NOR FLASH和NAND FLASH设备提供统一接口.MTD将文件系统与底层FLASH存储 ...
- [terry笔记]RMAN综合学习之恢复
[terry笔记]RMAN综合学习之备份http://www.cnblogs.com/kkterry/p/3308405.html [terry笔记]RMAN综合学习之恢复 http://www.cn ...
- Swift学习初步(一)
前几天刚刚将有关oc的教程草草的看了一遍,发现oc其实也不像传说的那么难.今天又开始马不停蹄的学习Swift因为我很好奇,到底苹果出的而且想要代替oc的编程语言应该是个什么样子呢?看了网上的一些中文教 ...
- Redis到底该如何利用?【转自:http://www.cnblogs.com/capqueen/p/HowToUseRedis.html】
Redis是个好东西,经过上两个星期的研究和实践,目前正在项目里大规模的替换掉原来的本地内存cache.但是替换过程中却发现,Redis这东西高端,大气上档次,似乎不是我想象里的使用方法. 在没有深入 ...