UIWindow,UINavigationController与UIViewController之间的关系
UIWindow,UINavigationController与UIViewController之间的关系

虽然每次你都用UINavigationController与UIWindow,但你不一定知道他们之间到底怎么运作的哦:)
AppDelegate.h的代码
RootViewController.m
//
// RootViewController.m
// UIWindow
//
// Copyright (c) 2014年 Y.X. All rights reserved.
// #import "RootViewController.h" #define VALUE 1 @interface RootViewController () @end @implementation RootViewController - (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor redColor]; UITapGestureRecognizer *tap = \
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(tapEvent:)]; [self.view addGestureRecognizer:tap];
} - (void)tapEvent:(UITapGestureRecognizer *)gesture
{
static int flag = ;
if (flag)
{
// 初始化3D变换,获取默认值
CATransform3D perspectiveTransform = CATransform3DIdentity; // 缩放变换
perspectiveTransform = CATransform3DScale(perspectiveTransform, 0.75, 0.75, 0.75); [UIView animateWithDuration:0.3 animations:^{
if (VALUE)
{
// 导航控制器的view
self.navigationController.view.transform = \
CATransform3DGetAffineTransform(perspectiveTransform);
}
else
{
// 自身controller的view
self.view.transform = CATransform3DGetAffineTransform(perspectiveTransform);
}
}]; flag = ;
}
else
{
// 初始化3D变换,获取默认值
CATransform3D perspectiveTransform = CATransform3DIdentity; // 缩放变换
perspectiveTransform = CATransform3DScale(perspectiveTransform, , , ); [UIView animateWithDuration:0.3 animations:^{
if (VALUE)
{
// 导航控制器的view
self.navigationController.view.transform = \
CATransform3DGetAffineTransform(perspectiveTransform);
}
else
{
// 自身controller的view
self.view.transform = CATransform3DGetAffineTransform(perspectiveTransform);
}
}]; flag = ;
}
} @end
VALUE = 1 的时候与 VALUE = 0 的时候


他们的关系其实非常简单.
UIWindow ---> UINavigationController ---> UIViewController,
有时候,我们需要做缩放动画的效果,或者是转场动画的效果,不理解他们之间细微的差距,是没办法处理好的.
他们之间的关系:

知道了这些原理,再写一个侧边栏,实在是太简单了:).
UIWindow,UINavigationController与UIViewController之间的关系的更多相关文章
- iOS 深入理解UINavigationController 和 UIViewController 之间的关系
创建三个类 BasicViewController : UIViewController SecondViewController : UIViewController ThirdViewContro ...
- 【iOS开发-72】设置状态栏的两种方式、程序生命周期以及更好地理解几大类(对象)之间的关系
(1)设置状态栏的2种方式 --第一种方式就是我们在控制器中设置,系统默认就是交给视图控制器去管理的,这样不同视图控制器能够自己定义不同的状态栏例如以下: -(BOOL)prefersStatusBa ...
- .NET Core与.NET Framework、Mono之间的关系
随着微软的.NET开源的推进,现在在.NET的实现上有了三个.NET Framework,Mono和.NET Core.经常被问起Mono的稳定性怎么样,后续Mono的前景如何,要回答这个问题就需要搞 ...
- .NET Core 和 .NET Framework 之间的关系
引用一段描述:Understanding the relationship between .NET Core and the .NET Framework. .NET Core and the .N ...
- 实体之间的关系【Entity Relationships】(EF基础系列篇9)
Here, you will learn how entity framework manages the relationships between entities. Entity framewo ...
- php CGI、Fastcgi、PHP-FPM的详细介绍与之间的关系
以下PHP CGI.Fastcgi.PHP-FPM的一些信息归纳和汇总----->详细介绍与之间的关系 一:CGI是干嘛的?CGI是为了保证web server传递过来的数据是标准格式的 web ...
- [转] valuestack,stackContext,ActionContext.之间的关系
三者之间的关系如下图所示: ActionContext 一次Action调用都会创建一个ActionContext 调用:ActionContext context = ActionContext ...
- angular源码阅读,依赖注入的原理:injector,provider,module之间的关系。
最开始使用angular的时候,总是觉得它的依赖注入方式非常神奇. 如果你跳槽的时候对新公司说,我曾经使用过angular,那他们肯定会问你angular的依赖注入原理是什么? 这篇博客其实是angu ...
- JavaScript和Java之间的关系
今天来简单而又详细地说说JavaScript和Java的关系. 开门见山总结性一句话,它们之间的关系 = 雷锋和雷峰塔之间的关系,换句话说:它们之间没什么关系. 但往往有不少初学者甚至中级者认为它们之 ...
随机推荐
- 详解C#委托和事件(一)
委托(Delegate)是安全封装方法的类型,类似于C和C++中的函数指针,与函数指针不同的是,委托是面向对象的.类型安全的和可靠的: 一.委托类型是CTS中五种基础类型之一,是一种引用类型,表示对具 ...
- 共识算法:Paxos
两阶段提交 Two-phase Commit(2PC):保证一个事务跨越多个节点时保持 ACID 特性: 两类节点:协调者(Coordinator)和参与者(Participants),协调者只有一个 ...
- 获得Spring容器
1. WebApplicationContext wac = ContextLoader.getCurrentWebApplicationCon; 2. ClassPathXmlApplication ...
- java 使用 pdf.js 在线查看 pdf 文档
1. 下载对应的 pdf.js 文件: 推荐地址: https://github.com/mozilla/pdf.js/ http://mozilla.g ...
- linux 权限详解
转载自博客园: http://www.cnblogs.com/123-/p/4189072.html 用户组 在linux中的每个用户必须属于一个组,不能独立于组外.在linux中每个文件有所有者.所 ...
- [codeup] 1128 出租车费
题目描述 某市出租车计价规则如下:起步4公里10元,即使你的行程没超过4公里:接下来的4公里,每公里2元:之后每公里2.4元.行程的最后一段即使不到1公里,也当作1公里计费. 一个乘客可以根据行程公里 ...
- Node.js数据流Stream之Readable流和Writable流
一.前传 Stream在很多语言都会有,当然Node.js也不例外.数据流是可读.可写.或即可读又可写的内存结构.Node.js中主要包括Readable.Writable.Duplex(双工)和Tr ...
- [转]使用BCP导出导入数据
本文转自:http://www.cnblogs.com/zerocc/p/3225723.html bcp 实用工具可以在 Microsoft SQL Server 实例和用户指定格式的数据文件间大容 ...
- Mysql汉字乱码的解决
在安装Mysql时其实可能选择使用GBK来处理汉字,由于以前没使用,所以就按默认的英语处理.不过,也可以C:\Program Files\MySQL\MySQL Server 6.8安装路径下的my文 ...
- 添加右键使用 SublimeText 打开
最近修改了系统,重新安装 SublimeText 但是在安装的时候忘记设置右键使用 SublimeText 打开,所以就需要写注册表. 可以复制下面的代码到一个记事本,然后保存为 sublime_ad ...