• 新建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. python版本管理--pyenv

    python版本环境管理 下载依赖 yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readli ...

  2. android4.4系统永不锁屏

    android4.4\frameworks\base\packages\Keyguard\src\com\android\keyguard\KeyguardViewMediator.java /** ...

  3. Zoho CEO:云计算泡沫巨大 Salesforce仅仅是新的Siebel

    最近Zoho CEO - Sridhar Vembu接受科技博客媒体Diginomica的专訪,从独特的眼光和见解.讲述了云计算行业环境.SaaS公司的生存状态.商业观念以及Zoho的商业模式. Sr ...

  4. struts2异常处理

    <global-results> <result name="nullException">/WEB-INF/exception/nullException ...

  5. C# 字符串数组转换为整形数组

    /// <summary> /// 字符串数组转换整形数组 /// </summary> /// <param name="Content">字 ...

  6. HTTP协议,详解

    整合网上各种资料,原创,不懂可以加 QQ:3111901846 一般学习一样新的知识,你首先要问问自己这三个问题,如果学完以后,你能回答出来这几个问题,证明你还是不错的 1.什么是HTTP协议?2.H ...

  7. python3 JSON对象的学习

    import jsonname = { 'alex':[22,'M'], 'tony':[21,'F'],} name_after = json.dumps(name)name_after = nam ...

  8. mysql创建账号对应的数据库方法

    增加一个用户mydb密码为123450, 让他只可以在(localhost/%)%表示可以支持远程上登录,并可以对数据库mydata5_db进行查询.插入.修改.删除的操作. grant select ...

  9. MySQL怎样存储IP地址

    为什么要问如何存储IP 首先就来阐明一下部分人得反问:为什么要问IP得怎样存,直接varchar类型不就得了吗? 其实做任何程序设计都要在功能实现的基础上最大限度的优化性能.而数据库设计是程序设计中不 ...

  10. 设置phpcms v9黄页模块作为首页方法

    如果我们根据需要,想把黄页作为单独的网站,我们可以用模块化安装,并且首页设置,那么仿站网就说说详细的步骤.首先,我们需要安装最新版本的phpcms V9其次,下载黄页模块,然后进行根目录的替换.再次, ...