//
// TWFXSecondViewController.m
// DemoMultiView
//
// Created by Lion User on 12-12-24.
// Copyright (c) 2012年 Lion User. All rights reserved.
// #import "TWFXSecondViewController.h"
#import "TWFXThirdViewController.h" @interface TWFXSecondViewController () @end @implementation TWFXSecondViewController
@synthesize thirdViewController; - (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 from its nib.
} - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} /*
多视图切换,如果是从A视图跳转到B视图,那么A表示当前视图,B表示将要跳转到视图
多视图跳转可以理解为有两部分:从A跳到B, B 返回 A.注意,是返回,不是重新发起跳转
这里是第二阶段:从B返回A self.presentingViewController 在跳转发生后有效,表示B试图的上一个视图,在这里为A视图
self.presentedViewController 在跳转发生后有效,表示B视图的下一个视图,在这里为nil,以为并没有发生跳转
self.parentViewController表示B的父试图,也为nil
*/
-(IBAction)btnClicGoBack:(UIButton *)sender{ void(^task)() = ^{ NSLog(@"2self: %@",self);
NSLog(@"2back ed%@",self.presentedViewController);
NSLog(@"2back ing%@",self.presentingViewController);
// NSLog(@"back par%@",self.parentViewController);
printf("\n\n"); }; // task(); //跳转完成后调用completion,此时,当前视图已被销毁,self.presentedViewController self.presentingViewController都为nil
[self dismissViewControllerAnimated:YES completion:nil]; task();//此时,当前视图还没被销毁,self.presentingViewController 表示上一个视图 } - (IBAction)btnClickTraToFirst:(UIButton *)sender {
} /*
这里表示从B视图跳到C视图
*/
- (IBAction)btnClickTra:(UIButton *)sender { if (self.thirdViewController == nil) { /*
最常用的初始化方法
nibName 表示xib文件的名字,不包括扩展名
nibBundle 制定在那个文件束中搜索制定的nib文件,如在主目录下,则可以直接用nil
*/
self.thirdViewController = [[[TWFXThirdViewController alloc] initWithNibName:@"TWFXThirdViewController" bundle:nil]autorelease] ; } //视图切换的动画效果
self.thirdViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; void(^task)() = ^{ NSLog(@"2self: %@",self);
NSLog(@"2go ed%@",self.presentedViewController);
NSLog(@"2go ing%@",self.presentingViewController);
// NSLog(@"go par%@",self.parentViewController);
printf("\n\n");
};
// task = ^(){}; // task();//跳转前没意义 /*
completion是一个回调,当 当前视图(这里是TWFXViewController) 的viewDidDisear调用后,该回调被调用
self.presentingViewController(表示上一个视图)为A视图
self.presentedViewController(表示下一个试图)为C视图
*/
[self presentViewController:thirdViewController animated:YES completion:task]; } @end

ios学习:页面跳转(present)的更多相关文章

  1. JavaWeb学习——页面跳转方式

    JavaWeb学习——页面跳转方式 摘要:本文主要学习了请求转发和响应重定向,以及两者之间的区别. 请求转发 相关方法 使用HttpServletRequest对象的 getRequestDispat ...

  2. iOS学习——页面的传值方式

    一.简述 在iOS开发过程中,页面跳转时在页面之间进行数据传递是很常见的事情,我们称这个过程为页面传值.页面跳转过程中,从主页面跳转到子页面的数据传递称之为正向传值:反之,从子页面返回主页面时的数据传 ...

  3. IOS系统设置页面跳转

    目录: 跳转 iOS10- 版本跳转url转 iOS10+ 版本跳转url转 跳转符 跳转到系统设置界面代码: // 自己应用的设置界面:url = UIApplicationOpenSettings ...

  4. [ios][switf]页面跳转

    参考:http://bbs.csdn.net/topics/390899712 注意用push会崩溃 用其他的正常 1.storyboard直接拖拉,使用不同种类的segue均可2.直接写代码: // ...

  5. ios ViewController 页面跳转

    从一个Controller跳转到另一个Controller时,一般有以下2种: 1.利用UINavigationController,调用pushViewController,进行跳转:这种采用压栈和 ...

  6. iOS 多页面跳转同一页面时数据处理

    如果 同一个界面, 会有10个数据源传进来, 此时 创建 一个总模型fullmodel 存储 10个model 数据, 创建 10个一样的cell, 在 不同数据, 用不同cell处理最好, 千万别于 ...

  7. iOS——使用StroryBoard页面跳转及传值

    之前在网上搜iOS的页面跳转大多都是按回以前的那种xib的形式,但鄙人是使用storyboard的.这篇就只介绍利用storyboard进行页面跳转与传值. 新建页面 iOS的程序也是使用了MVC的思 ...

  8. iOS使用StroryBoard页面跳转及传值

    之前在网上iOS的页面跳转大多都是按回以前的那种xib的形式,但鄙人是使用storyboard的.这篇就只介绍利用storyboard进行页面跳转与传值. 新建页面 iOS的程序也是使用了MVC的思想 ...

  9. ios学习-delegate、传值、跳转页面

    ios学习-delegate.传值.跳转页面     1.打开xcode,然后选择ios--Application--Empty Application一个空项目. 项目目录: 2.输入项目名称以及选 ...

  10. [转]iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController

    转载地址:http://blog.csdn.net/totogo2010/article/details/7682433 iOS学习之UINavigationController详解与使用(一)添加U ...

随机推荐

  1. Type mytableview does not confirm to portocol UITableViewDataResource

    继承UITableViewDataSource报上面这个总是,是重写协议时写错了 override func numberOfRowsInSection(section: Int) -> Int ...

  2. CentOS中查看系统资源占用情况的命令

    用 'top -i' 看看有多少进程处于 Running 状态,可能系统存在内存或 I/O 瓶颈,用 free 看看系统内存使用情况,swap 是否被占用很多,用 iostat 看看 I/O 负载情况 ...

  3. Qt增加webp格式支持

    Webp 是一种图片文件格式,能在相同质量的情况下比 PNG 文件尺寸小巧. Chrome 应用商店图片已全部转换为 WebP 格式 YY(基于Qt开发)也已经把图片格式换成webp了 http:// ...

  4. Sky number

    描述 key 天生对数字特别敏感,一次偶然的机会,他发现了一个有趣的四位数2992,这个数,它的十进制数表示,其四位数字之和为2+9+9+2=22,它的十六进 制数BB0,其四位数字之和也为22,同时 ...

  5. Cheap CK100 1024 tokens NXP FIX Chip on Eobd2

    CK100 is a well-known and cost-effective key programmer for many cars. Some said it is a must for bo ...

  6. ArcGIS: version not specified. You must call RuntimeManager.Bind before creat

    打开program.cs把ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);这句放到Applicatio ...

  7. arcgis mdb和gdb编辑区别

    arcgis gdb保存时错误会提供行包含错误值:[DJH3],mdb不会,只会提示字段值太小

  8. some words we should know

    2010年,芬兰艺术家Mikko Kuorinki做了一件独特的艺术品. 他在赫尔辛基的奇亚斯玛当代艺术博物馆(Kiasma museum),找了一堵墙,装了一个175 x 320cm的木架子,上面用 ...

  9. CF A and B and Chess

    A and B and Chess time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  10. [改善Java代码]多种最值算法,适时选择

    建议64:多种最值算法,适时选择. 对一批数据进行排序,然后找出其中的最大值或最小值,这是基本的数据结构知识.在Java中我们可以通过编写算法的方式,也可以通过数组先排序再取值的方式来实现.下面以求最 ...