Storyboards
这里是吐槽时间,换掉了mac默认的输入法,出发点只有一个,就是切换中英文输入的时候相当不爽。也许是习惯了其他各大输入法的一键切换,而又没有找到自带输入法可设置的地方。
Segue
以前我们使用navigation controller 去push view controller, storyboards 里面相应的概念就是segue.还有一种切换的方式是modal view controller 从地下临时的弹出。类似于Jquery ui 中的模态对话框。prepareForSegue:sender:是一个重要的方法,你可以在这里传递数据到下一个view.
在一个StoryBoards上放两个ViewController
通过Ctrl 和拉伸或者右键拉伸的方式,连接两个view controller.
identifier
我们给这个segue 一个唯一识别名: pushLogin. 为什么我们需要这个识别名,因为我们打算在跳转之前作一些validation,比如说确认下客户的输入是否正确,否则我们不允许用户跳转到下一步。shouldPerformSegueWithIdentifi er:sender: method of UIViewController 就是我们执行validation 的方法。
因此我们上面的发送账户验证请求,不再需要绑定在按钮按下的事件中。
Synchronous http request
上面我们使用的是异步http request的方式,其实我们想要同步的分析请求结果,再确定是否跳转,因此这里需要阻塞。
NSURLResponse response = nil; NSError error = nil; NSData *data = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
当然,验证不通过,我们需要一个alert
- (void) showAccountIsNotValid{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"该用户不存在!" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; [alert show];}
Storyboards的更多相关文章
- Xcode5中如何切换Storyboards为xib
在Xcode5中,当创建一个带View的iPhone项目时,默认必须使用Storyboards,不再支持切换xib的checkbox.本文讲解如何手动切换到使用xib来布局. 1,把Main.stor ...
- 【Xamarin Doc】 Introduction to Storyboards 笔记
http://developer.xamarin.com/guides/ios/user_interface/introduction_to_storyboards/ Segues There are ...
- iphone dev 入门实例1:Use Storyboards to Build Table View
http://www.appcoda.com/use-storyboards-to-build-navigation-controller-and-table-view/ Creating Navig ...
- scenes & segues within storyboards
Scenes Scenes in a storyboard represent content shown within one screen in your application. A scene ...
- 从零开始学ios开发(十八):Storyboards(下)
这篇我们完成Storyboards的最后一个例子,之前的例子中没有view之间的切换,这篇加上这个功能,使Storyboards的功能完整呈现.在Storyboards中负责view切换的东西叫做“s ...
- 从零开始学ios开发(十七):Storyboards(上)
在开始这章之前,先做个说明,从这篇开始,我所使用的xcode更新成了最新的版本,版本是4.6.1(4H512),如下: 大家可以打开自己电脑上的App Store,然后搜索xcode,第一个出现的就是 ...
- Storyboards vs NIB vs Code 大辩论
前言 做iOS开发的童鞋都应该会纠结一个问题,那就是在做开发的时候是使用StoryBoard还是使用Nibs又或者是Code(纯代码流)呢?笔者也非常纠结这个问题,今天碰巧在raywenderlich ...
- 转换到 StoryBoard 的公布说明(Converting to Storyboards Release Notes)
转换到 StoryBoard 的公布说明(Converting to Storyboards Release Notes) 太阳火神的漂亮人生 (http://blog.csdn.net/opengl ...
- Storyboards Tutorial 01
Storyboarding 是在ios 5时候引进入的一个非常出色的特性.节省了为app创建user interfaces的时间.
随机推荐
- 【GoLang】GoLang 中 make 与 new的区别
make.new操作 make用于内建类型(map.slice 和channel)的内存分配.new用于各种类型的内存分配. 内建函数new本质上说跟其它语言中的同名函数功能一样:new(T)分配了零 ...
- Walls and Gates
You are given a m x n 2D grid initialized with these three possible values. -1 - A wall or an obstac ...
- poj 3984
http://poj.org/problem?id=3984 题目很简单,就是简单的BFS吧,主要的难点在于坐标的问题 这个呢,可以反其道而行之,就是你从(1,1)到(5,5),你肯定走过一次 走过一 ...
- hdu1520
基本的树形dp #include <cstring> #include <cstdio> #include <vector> using namespace std ...
- hdu3652
基本的数位dp,需要记录前面除以13的余数. #include <cstdio> #include <cstring> using namespace std; #define ...
- Sql Server事务简单用法
var conStr = "server=localhost;database=Data;user=sa;pwd=123456"; using (var connection = ...
- JAVA volatile 关键字
一.volatile(易变的) Java 语言提供了一种稍弱的同步机制,即volatile修饰变量.用来确保将变量的更新操作通知到其他线程,保证了新值能立即同步到主内存,以及每次使用前立即从主内存刷新 ...
- 头文件algorithm中的常用函数
非修改性序列操作(12个) 循环 对序列中的每个元素执行某操作 for_each() 查找 在序列中找出某个值的第一次出现的位置 fin ...
- unbutu下搭建FTP服务
安装 apt-get install vsftpd 启动 service vsftpd start 第一次连接的时候出了点问题,报了一个 login incorrect 530的连接错误 然后百度了一 ...
- struts2拦截器+监听器 .
一.拦截器是怎么实现: 实际上它是用Java中的动态代理来实现的 二.拦截器在Struts2中的应用 对于Struts2框架而言,正是大量的内置拦截器完成了大部分操作.像params拦截器将http请 ...