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类型的对象,此对象看成是 ...
随机推荐
- Mongod(5):启动命令mongod参数说明
Mongodb启动命令mongod参数说明(http://blog.csdn.net/fdipzone/article/details/7442162) mongod的主要参数有: 基本配置 ---- ...
- ThinkPHP之中getlist方法实现数据搜索功能
自己在ThinkPHP之中的model之中书写getlist方法,其实所谓的搜索功能无非就是数据库查询之中用到的like %string%,或者其他的 字段名=特定值,这些sql语句拼接在and语句 ...
- sql,插入最大值加1
insert into aa (id,name) values((select case when max(id) is null then 1 else max(id)+1 end from aa) ...
- SQLServer2005,2000获取表结构:字段名、类型、长度、主键、非空、注释
SQLServer 2005 SELECT d.name N'TableName', d.xtype N'TableType', a.colorder N'ColumnIndex', a.name N ...
- 机器学习简易入门(四)- logistic回归
摘要:使用logistic回归来预测某个人的入学申请是否会被接受 声明:(本文的内容非原创,但经过本人翻译和总结而来,转载请注明出处) 本文内容来源:https://www.dataquest.io/ ...
- python 校招信息爬虫程序
发现一个爬虫程序,正在学习中: https://github.com/lizherui/spider_python
- ubuntu 14.04 下安装jdk8及 smartgithg
公司使用git作为源码管理,又需要在ubuntu下工作,然后,自己就找了找,目前ubuntu下的git gui客户端,感觉 smartgit算是其中比较好用的一个,下边是具体安装步骤 说明,smart ...
- angularjs2 学习笔记(二) 组件
angular2 组件 首先了解angular2 组件的含义 angular2的应用就是一系列组件的集合 我们需要创建可复用的组件供多个组件重复使用 组件是嵌套的,实际应用中组件是相互嵌套使用的 组件 ...
- zip解压缩
package com.green.project.compress; import java.io.File;import java.io.FileInputStream;import java.i ...
- css权重及优先级问题
css权重及优先级问题 几个值的对比 初始值 指定值 计算值 应用值 CSS属性的 指定值 (specified value)会通过下面3种途径取得: 在当前文档的样式表中给这个属性赋的值,会被优先使 ...