• 新建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的更多相关文章

  1. 多视图学习(multiview learning)

    多视图学习(multi-view learning) 前期吹牛:今天这一章我们就是来吹牛的,刚开始老板在和我说什么叫多视图学习的时候,我的脑海中是这么理解的:我们在欣赏妹子福利照片的时候,不能只看45 ...

  2. ASP.NET服务器控件使用之MultiView和View

    MultiView 控件是一组 View 控件的容器.使用它可定义一组 View 控件,其中每个 View 控件都包含子控件. 用 ActiveViewIndex 属性或SetActiveView 方 ...

  3. 【转】ASP.NET服务器控件使用之MultiView和View

    MultiView 和 View 控件和制作出选项卡的效果,MultiView 控件是一组 View 控件的容器.使用它可定义一组 View 控件,其中每个 View 控件都包含子控件. 如果要切换视 ...

  4. 从零开始学ios开发(十):Multiview Applications(多个xib之前的切换)

    这篇学习的主要内容是Multiview,在我们学习iphone旋转的时候,介绍过多个view的使用方法,不过这里的view和旋转屏幕中所指的多个view是不同的,旋转屏幕中涉及到的多个view是在一个 ...

  5. MultiView空间例子

    CSS代码: body { font-size:11pt; font-family:宋体; } .mainTitle { font-size:11pt; font-weight:bold; font- ...

  6. Multi-View 3D Reconstruction with Geometry and Shading——Part-2

    From PhDTheses Multi-View 3D Reconstruction with Geometry and Shading 我们的主要目标是只利用图像中的信息而没有额外的限制或假设来得 ...

  7. Multi-View 3D Reconstruction with Geometry and Shading——Part-1

    From PhDTheses Multi-View 3D Reconstruction with Geometry and Shading 计算机视觉的主要任务就是利用图像信息能智能理解周围的世界. ...

  8. face detection[Multi-view face detection&& MTCNN]

    因为这两篇论文感觉内容较短,故而合并到一个博文中. Multi-view face detection 本文来自<Multi-view Face Detection Using Deep Con ...

  9. Multi-View Region Adaptive Multi-temporal DMM and RGB Action Recognition

    论文标题:Multi-View Region Adaptive Multi-temporal DMM and RGB Action Recognition 来源/作者机构情况: 解决问题/主要思想贡献 ...

  10. Firemonkey MultiView

    MultiView 做导航用的. http://docwiki.embarcadero.com/RADStudio/Seattle/en/Mobile_Tutorial:_Using_a_MultiV ...

随机推荐

  1. 算法笔记_072:N皇后问题(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 把n个皇后放在一个n*n的棋盘上,使得任何两个皇后都不能相互攻击,即它们不能同行,不能同列,也不能位于同一条对角线上. 2 解决方案 本文采用全排列 ...

  2. Java多态和动态绑定是如何实现的

    最近深入学习java,看到了动态绑定和多态这一章节,但遗憾的是,大部分的相关文章都停留于表面文字的描述.不得已,最后google了几篇英文文章,在此总结下这个问题. 一.静态绑定和动态绑定的区别 在J ...

  3. jBoss设置jvm参数

    jBoss版本: jboss-5.1.0.GA jboss-6.0.0.Final   jboss-5.1.0.GA和jboss-6.0.0.Final修改方法: 打开%JBOSS_HOME%\bin ...

  4. T-sql isnull函数介绍

    今天在给同事调取数据的时候,同事反馈说数据偏少,我仔细检查,发现sql语句条件都正确,逻辑没哪里不对,最后经过仔细排查,才发现问题出在null字段上 表中有一列是允许为null值,比如查询名字不为测试 ...

  5. 点击button触发onclick事件判空后依旧自动跳转

    这是一个前端的问题. 其中判断字符串为空的脚本代码是这样的: var remark = $("#Remark").val(); //判空.注意:var reg = /空格/g; v ...

  6. 从1KW条数据中筛选出1W条最大的数

    using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ...

  7. MapReduce实现两表的Join--原理及python和java代码实现

    用Hive一句话搞定的,可是有时必需要用mapreduce 方法介绍 1. 概述 在传统数据库(如:MYSQL)中,JOIN操作是很常见且很耗时的.而在HADOOP中进行JOIN操作.相同常见且耗时, ...

  8. windows和linux中换行符的转换

    数据开发平台使用上传脚本报错:保存失败,文件编码格式不正确,请修改文件换行符为Unix终束符! 修改方式:DOS系统下,使用文本编译器另存为,然后选择换行符为unix终束符. 解释: windows ...

  9. unity, unity中GL.MultMatrix的一个超级bug

    GL.MultMatrix与OpenGL固定管线的glMultMatrix函数行为并不一致,不是累乘,而是覆盖. 例如下面例子,本来预期是在(100,100)处画一个方块,而实际效果却是在(0,0)处 ...

  10. setTime

    var getTime = function() { var _ = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09'], //补 ...