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类型的对象,此对象看成是 ...
随机推荐
- JSON,JSONP
http://blog.csdn.net/huaishuming/article/details/40046729 说明: 在做2个系统间传值时出现: 已阻止交叉源请求:同源策略不允许读取 http: ...
- Java垃圾回收基础
- Android图表
最近需要用到Android里面的折现图,因此在这方面也去做了一些调研.总体发现Android对报表的支持还是非常好的.总体上去研究了两个实现方案,一个是利用Android提供的的AChartEngin ...
- 问题记录-Activity跳转后显示空白界面
前两天写一个简易安卓记事本,从主界面跳转到添加内容界面总是显示空白. 明明有setContentView xml文件在可视化开发环境下也正常显示.后经前辈指点,原来是复写onCreate函数时出现了问 ...
- JavaScrip拖动动画中的常见BUG
经常我们在用JS辛苦写完一个拖动效果之后 ,发现有各种无法用JS解决的BUG.比如拖动时DOM元素中的内容会变蓝,鼠标的指示会变为一个小+号,或disable的样式,通常这种情况一发生,我们的拖动效果 ...
- 《Prism 5.0源码走读》UnityBootstrapper
UnityBootstrapper (abstract class)继承自Bootstrapper(abstract)类, 在Prism.UnityExtensions.Desktop project ...
- static 与 final 修饰符
A) 用static(静态)修饰属性:一个类生成了N个对象,这些对象会共同使用一份静态的成员变量.一个对象对这个成员变量进行修改,其他对象的该成员变量的值也会随之变化. B) 我们可以通过 类名.成员 ...
- java遍历Map的几种方式
1.遍历map的几种方式:private Hashtable<String, String> emails = new Hashtable<String, String>(); ...
- 微软CRM解决医药企业串货之痛
没有准确.及时的流向数据统计和分析,医药企业营销部门就无法有效管理串货泛滥问题,串货会造成渠道无利可赚,挫伤渠道的积极性,产品无人愿意卖,最终伤害的还是医药企业. 医药企业营销发展的不同阶段对串货的态 ...
- OpenStack:安装Glance
>安装Glance1. 安装# apt-get install glance python-glanceclient删除sqlite文件rm -f /var/lib/glance/glance. ...