Multiview
- 新建3个ViewController的类
- 新建main.stroyboard,并配置好相应的布局(编辑界面,连接视图与类,ViewController的Storyboard ID,连接3个Button的响应事件)
- 删除app delegate中didFinishLaunchingWithOptions中的代码
- 修改SwitchViewController.m代码(viewDidLoad,didReceiveMemoryWarning,switchButton的响应函数(包括动画))
- 修改BlueViewController.m和YellowViewController.m,添加button响应函数
XYZSwitchViewController.m
//
// XYZSwitchViewController.m
// MultiView
//
// Created by Norcy on 14-7-23.
// Copyright (c) 2014年 QQLive. All rights reserved.
// #import "XYZSwitchViewController.h"
#import "XYZBlueViewController.h"
#import "XYZYellowViewController.h" @interface XYZSwitchViewController ()
@property (strong, nonatomic)XYZBlueViewController *blueViewController;
@property (strong, nonatomic)XYZYellowViewController *yellowViewController;
@end @implementation XYZSwitchViewController - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.blueViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Blue"]; [self.view insertSubview:self.blueViewController.view atIndex:];
} - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
if (!self.yellowViewController.view.superview)
self.yellowViewController = nil;
else
self.blueViewController = nil;
} - (IBAction)switchViews:(id)sender
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
if (!self.yellowViewController.view.superview)
{
if (!self.yellowViewController)
self.yellowViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Yellow"];
[self.blueViewController.view removeFromSuperview];
[self.view insertSubview:self.yellowViewController.view atIndex:];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
}
else
{
if (!self.blueViewController)
self.blueViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Blue"];
[self.yellowViewController.view removeFromSuperview];
[self.view insertSubview:self.blueViewController.view atIndex:];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
}
[UIView commitAnimations];
}
@end
XYZBlueViewController.m
//
// XYZBlueViewController.m
// MultiView
//
// Created by Norcy on 14-7-23.
// Copyright (c) 2014年 QQLive. All rights reserved.
// #import "XYZBlueViewController.h" @interface XYZBlueViewController () @end @implementation XYZBlueViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
} - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
} - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} - (IBAction)blueBtnPressed:(id)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Blue" delegate:self.view cancelButtonTitle:@"Got it" otherButtonTitles:nil]; [alert show];
}
@end
XYZYellowViewController.m同理,所有头文件保持不变。



Multiview的更多相关文章
- 多视图学习(multiview learning)
多视图学习(multi-view learning) 前期吹牛:今天这一章我们就是来吹牛的,刚开始老板在和我说什么叫多视图学习的时候,我的脑海中是这么理解的:我们在欣赏妹子福利照片的时候,不能只看45 ...
- ASP.NET服务器控件使用之MultiView和View
MultiView 控件是一组 View 控件的容器.使用它可定义一组 View 控件,其中每个 View 控件都包含子控件. 用 ActiveViewIndex 属性或SetActiveView 方 ...
- 【转】ASP.NET服务器控件使用之MultiView和View
MultiView 和 View 控件和制作出选项卡的效果,MultiView 控件是一组 View 控件的容器.使用它可定义一组 View 控件,其中每个 View 控件都包含子控件. 如果要切换视 ...
- 从零开始学ios开发(十):Multiview Applications(多个xib之前的切换)
这篇学习的主要内容是Multiview,在我们学习iphone旋转的时候,介绍过多个view的使用方法,不过这里的view和旋转屏幕中所指的多个view是不同的,旋转屏幕中涉及到的多个view是在一个 ...
- MultiView空间例子
CSS代码: body { font-size:11pt; font-family:宋体; } .mainTitle { font-size:11pt; font-weight:bold; font- ...
- Multi-View 3D Reconstruction with Geometry and Shading——Part-2
From PhDTheses Multi-View 3D Reconstruction with Geometry and Shading 我们的主要目标是只利用图像中的信息而没有额外的限制或假设来得 ...
- Multi-View 3D Reconstruction with Geometry and Shading——Part-1
From PhDTheses Multi-View 3D Reconstruction with Geometry and Shading 计算机视觉的主要任务就是利用图像信息能智能理解周围的世界. ...
- face detection[Multi-view face detection&& MTCNN]
因为这两篇论文感觉内容较短,故而合并到一个博文中. Multi-view face detection 本文来自<Multi-view Face Detection Using Deep Con ...
- Multi-View Region Adaptive Multi-temporal DMM and RGB Action Recognition
论文标题:Multi-View Region Adaptive Multi-temporal DMM and RGB Action Recognition 来源/作者机构情况: 解决问题/主要思想贡献 ...
- Firemonkey MultiView
MultiView 做导航用的. http://docwiki.embarcadero.com/RADStudio/Seattle/en/Mobile_Tutorial:_Using_a_MultiV ...
随机推荐
- SurfaceView绘制录音波形图
本文简单记录由View绘制转为SurfaceView绘制的波形图问题. 上代码: public class VoiceLineView extends View { private final int ...
- LR学习笔记之—参数和变量
一.LR中参数的使用 LR中参数默认使用“{}”来表示,如果想要修改,可以再General Options/Parameterization设置参数的边界字符 经常用到的函数: lr_save_str ...
- javascript数据结构和算法 第二章 (数组) 二
字符串表示的数组 join() 和 toString() 函数返回数组的字符串表示.这两个函数通过将数组中的元素用逗号分隔符切割,返回字符串数组表示. 这里有个样例: var names = [&qu ...
- .gnet标准
1 预祝 .gnet进军w3c!!!成为html5的标准 2 .gnet在进行压缩的时候.图片信息不会丢失 3 .gnet须要csdn.百度搜索.360.腾讯.新浪微博.各种视频软件的支持..! ...
- R内存扩展 win7内存扩展
安装包 imdiskinst 文件 램디스크 사용http://www.ltr-data.se/ http://cruciancar.blog.me/150101634586 --TEMP 변수 TE ...
- 怎样优化UITableView的性能
在iOS App中,UITableView应该是使用率最高的.同一时候也是最为复杂的视图. 差点儿全部自带的应用中都能看到它的身影,可见它的重要性. 在使用UITableView时,会常常遇到性能上的 ...
- atitit.js javascript 调用c# java php后台语言api html5交互的原理与总结p97
atitit.js javascript 调用c# java php后台语言api html5交互的原理与总结p97 1. 实现html5化界面的要解决的策略1 1.1. Js交互1 1.2. 动态参 ...
- django rest framework(10)
1.权限 2.认证 3.访问频率限制 4.序列化 5.路由 6.视图 7.分页 8.解析器 9.渲染器 10.版本 面试题:你写的类都继承过哪些类? class Vive(object): class ...
- 设计模式_Observable与Observer
一.基本概念 java.util.Observable 被观察者类,需要继承这个类 java.util.Observer 观察者类,需要实现这个接口中的update()方法 二.举例 Door ...
- SMP
SMP(Symmetrical Multi-Processing):对称多处理技术,是指在一个计算机上汇集了一组处理器(多CPU),各CPU之间共享内存子系统以及总线结构. 在smp系统中,所有的CP ...