//
// 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. 小白日记42:kali渗透测试之Web渗透-SQL盲注

    SQL盲注 [SQL注入介绍] SQL盲注:不显示数据库内建的报错信息[内建的报错信息帮助开发人员发现和修复问题],但由于报错信息中提供了关于系统的大量有用信息.当程序员隐藏了数据库内建报错信息,替换 ...

  2. python之装饰器详解

    这几天翻看python语法,看到装饰器这里着实卡了一阵,最初认为也就是个函数指针的用法,但仔细研究后发现,不止这么简单. 首先很多资料将装饰器定义为AOP的范畴,也就是Aspect Oriented ...

  3. [转]Oracle EBS APIs

    FROM:http://blog.csdn.net/pan_tian/article/details/7754598 API To Find Sales Order's Subtotal,discou ...

  4. 24小时学通Linux内核--内核探索工具类

    寒假闲下来了,可以尽情的做自己喜欢的事情,专心待在实验室里燥起来了,因为大二的时候接触过Linux,只是关于内核方面确实是不好懂,所以十天的时间里还是希望能够补充一下Linux内核相关知识,接下来继续 ...

  5. poj 2553 强连通分支与缩点

    思路:将所有强连通分支找出来,并进行缩点,然后找其中所有出度为0的连通分支,就是题目要求的. #include<iostream> #include<cstdio> #incl ...

  6. Linux下is not in the sudoers file解决方法

    最近在学习linux,在某个用户(xxx)下使用sudo的时候,提示以下错误:xxx is not in the sudoers file. This incident will be reporte ...

  7. iOS下使用sqlite3

    1.创建数据库 使用firefox的sqlite manager创建和打开数据库,详细请参考: http://www.cnblogs.com/hanjun/archive/2012/10/29/274 ...

  8. Nginx - Configuration File Syntax

    Configuration Directives The Nginx configuration file can be described as a list of directives organ ...

  9. nginx限制ip请求次数 以及并发次数

    如何设置能限制某个IP某一时间段的访问次数是一个让人头疼的问题,特别面对恶意的ddos攻击的时候.其中CC攻击(Challenge Collapsar)是DDOS(分布式拒绝服务)的一种,也是一种常见 ...

  10. Win7 IIS (HTTP Error 500.21 - Internal Server Error)解决

    今天在测试网站的时候,在浏览器中输入http://localhost/时,发生如下错误: HTTP Error 500.21 - Internal Server Error Handler " ...