ios学习:页面跳转(present)
//
// 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)的更多相关文章
- JavaWeb学习——页面跳转方式
JavaWeb学习——页面跳转方式 摘要:本文主要学习了请求转发和响应重定向,以及两者之间的区别. 请求转发 相关方法 使用HttpServletRequest对象的 getRequestDispat ...
- iOS学习——页面的传值方式
一.简述 在iOS开发过程中,页面跳转时在页面之间进行数据传递是很常见的事情,我们称这个过程为页面传值.页面跳转过程中,从主页面跳转到子页面的数据传递称之为正向传值:反之,从子页面返回主页面时的数据传 ...
- IOS系统设置页面跳转
目录: 跳转 iOS10- 版本跳转url转 iOS10+ 版本跳转url转 跳转符 跳转到系统设置界面代码: // 自己应用的设置界面:url = UIApplicationOpenSettings ...
- [ios][switf]页面跳转
参考:http://bbs.csdn.net/topics/390899712 注意用push会崩溃 用其他的正常 1.storyboard直接拖拉,使用不同种类的segue均可2.直接写代码: // ...
- ios ViewController 页面跳转
从一个Controller跳转到另一个Controller时,一般有以下2种: 1.利用UINavigationController,调用pushViewController,进行跳转:这种采用压栈和 ...
- iOS 多页面跳转同一页面时数据处理
如果 同一个界面, 会有10个数据源传进来, 此时 创建 一个总模型fullmodel 存储 10个model 数据, 创建 10个一样的cell, 在 不同数据, 用不同cell处理最好, 千万别于 ...
- iOS——使用StroryBoard页面跳转及传值
之前在网上搜iOS的页面跳转大多都是按回以前的那种xib的形式,但鄙人是使用storyboard的.这篇就只介绍利用storyboard进行页面跳转与传值. 新建页面 iOS的程序也是使用了MVC的思 ...
- iOS使用StroryBoard页面跳转及传值
之前在网上iOS的页面跳转大多都是按回以前的那种xib的形式,但鄙人是使用storyboard的.这篇就只介绍利用storyboard进行页面跳转与传值. 新建页面 iOS的程序也是使用了MVC的思想 ...
- ios学习-delegate、传值、跳转页面
ios学习-delegate.传值.跳转页面 1.打开xcode,然后选择ios--Application--Empty Application一个空项目. 项目目录: 2.输入项目名称以及选 ...
- [转]iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController
转载地址:http://blog.csdn.net/totogo2010/article/details/7682433 iOS学习之UINavigationController详解与使用(一)添加U ...
随机推荐
- MySQL 5.7: Enhanced Multi-threaded slaves
http://geek.rohitkalhans.com/2013/09/enhancedMTS-deepdive.html 科学上网 Introduction Re-applying binar ...
- ssh连接阿里云一段时间不操作自动断开
打开/etc/ssh/sshd_config 添加或修改: ClientAliveInterval 120 ClientAliveCountMax 0
- linux的rpm命令
rpm 执行安装包二进制包(Binary)以及源代码包(Source)两种.二进制包可以直接安装在计算机中,而源代码包将会由 RPM自动编译.安装.源代码包经常以src.rpm作为后缀名. 常用命令组 ...
- cocos2d-x lua 触摸事件
cocos2d-x lua 触摸事件 version: cocos2d-x 3.6 1.监听 function GameLayer:onEnter() local eventDispatcher = ...
- iOS搜索框
在iOS8以前搜索框是作为一个控件添加到TableViewController中, 有系统自带的搜索变量self.searchDisplayController 遵守一个搜索显示的协议<UISe ...
- IE8 innerHTML赋值时包含多级HTML标签时的解决方案
var inhtml = ''; var font = document.createElement("font"); var a = document.createElement ...
- Angular学习资源汇集
网站 官网:www.angularjs.org 中文官网(社区):www.angularjs.cn 博客 流浪猫的窝 粉丝日记:AngularJS体验式编程系列文章 一介布衣 文档 GitCafe A ...
- Android编程心得-ListView的Item高亮显示的办法
在我们使用ListView的时候,经常会遇到某一项(Item)需要高亮显示的情况,如下图,有人说当我们点击子项的时候会变亮,但有时候业务逻辑需要让ITEM根据条件自动变亮,下面我来介绍一下我自己的解决 ...
- 今天写了几个css属性
<!DOCTYPE html> <html> <head> <meta charset=UTF-8"> <title></t ...
- 简单遗传算法求解n皇后问题
版权声明:本文为博主原创文章,转载请注明出处. 先解释下什么是8皇后问题:在8×8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行.同一列或同一斜线上,问有多少种摆法.在不 ...