1.prepareForSegue:

Now we know what the destinationViewController is we can set its data properties. To receive information back from a scene we use
delegation. Both are shown simply in the following code snipped.

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([[segue identifier] isEqualToString:@"ContactsViewControllerSegue"]){
ContactsViewController *cvc = (ContactsViewController *)[segue destinationViewController];
cvc.contacts = self.contacts;
cvc.delegate = self;
}
}

A final note about UIStoryboardSegue is that when you choose a popover transition you must get access to the popover in order to dismiss it. You can get this by casting the Segue to a UIStoryboardPopoverSegue but only after you have checked the identity of
the Segue to ensure you are making the correct cast.

2.UITableViewCell:

 static NSString *CellIdentifier = @"ContactsCell";
ContactsTableViewCell *cell = (ContactsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.contact = [contacts objectAtIndex:indexPath.row];

Note: That you can have as many different prototype cells as you wish the only requirement is that you set each one with a unique cell identifier.

It is also possible to create Segues between cells and ViewControllers to transition to a new scene when a cell is tapped. In the following screen shot you can see how to connect a cell to a UIViewController and by specifying Push as the transition mode we
now have a detailed view pushed on whenever a cell is tapped.

3.UIViewController:

UIStoryboard is a runtime representation of everything configured inside Interface Builder as such any individual scene can be loaded using either,

[UIStoryboard instantiateInitalViewController]
[UIStoryboard InstantiateViewControllerWithIdentifier]

Should you choose to split your application across multiple Storyboards these can be loaded using,

[UIStoryboard storyboardWithName:bundle:]

Storyboard 经常用法总结-精华版的更多相关文章

  1. 一看就懂的ReactJs入门教程(精华版)

    一看就懂的ReactJs入门教程(精华版) 现在最热门的前端框架有AngularJS.React.Bootstrap等.自从接触了ReactJS,ReactJs的虚拟DOM(Virtual DOM)和 ...

  2. ReactJs入门教程-精华版

    原文地址:https://www.cnblogs.com/Leo_wl/p/4489197.html阅读目录 ReactJs入门教程-精华版 回到目录 ReactJs入门教程-精华版 现在最热门的前端 ...

  3. Java Web项目案例之---登录和注册(精华版)

    登录和注册(精华版) (一)实现功能 1.使用cookie记录登录成功的用户名,用户选择记住用户名,则用户再次登录时用户名自动显示 2.实现文件上传功能(上传文件的表单上传于普通的表单上传不同,必须是 ...

  4. 【知识学习】Sublime Text 快捷键精华版

    Sublime Text 快捷键精华版 Ctrl+Shift+P:打开命令面板 Ctrl+P:搜索项目中的文件 Ctrl+G:跳转到第几行 Ctrl+W:关闭当前打开文件 Ctrl+Shift+W:关 ...

  5. sqlalchemy精华版

    上一篇主要粗略讲了Flask+mysql+sqlalchemy的使用,这次精讲下sqlalchemy的用法,话不多说,上代码. ----------sqlalchemy_test.py # -*- c ...

  6. java多线程(精华版)

    在 Java 程序中使用多线程要比在 C 或 C++ 中容易得多,这是因为 Java 编程语言提供了语言级的支持.本文通过简单的编程示例来说明 Java 程序中的多线程是多么直观.读完本文以后,用户应 ...

  7. Swift - 故事板storyboard的用法

    故事板(UIStoryboard)可以很方便的进行界面的设计,下面总结了常用的几个操作方法: 1,初始场景 选中View Controller,在属性面板里勾选Is Initial View Cont ...

  8. 黑马程序员_Java基础视频-深入浅出精华版--视频列表

    \day01\avi\01.01_计算机基础(计算机概述).avi; \day01\avi\01.02_计算机基础(计算机硬件和软件概述).avi; \day01\avi\01.03_计算机基础(软件 ...

  9. 课程2:《黑马程序员_Java基础视频-深入浅出精华版》-视频列表-

    \day01\avi\01.01_计算机基础(计算机概述).avi; \day01\avi\01.02_计算机基础(计算机硬件和软件概述).avi; \day01\avi\01.03_计算机基础(软件 ...

随机推荐

  1. Windows的TCP协议参数

    注册表编辑器:regedit 表项:HKEY_LOCAL_MACHINE\SYSTEM\CurentControlSet\Services\Tcpip\Parameters 窗口扩大因子 & ...

  2. vtk基础编程(2)-读取数据文件中的坐标点

    原文地址: http://blog.csdn.net/chinamming/article/details/16860051 1. 案例说明 在实际计算中,常常需要大量的数据, 这个时候数据文件就必不 ...

  3. C++内存管理(超长)

    [导语] 内存管理是C++最令人切齿痛恨的问题,也是C++最有争议的问题,C++高手从中获得了更好的性能,更大的自由,C++菜鸟的收获则是一遍一遍的检查代码和对C++的痛恨,但内存管理在C++中无处不 ...

  4. Tomcat 7最大并发连接数的正确修改方法(转)

    几乎所有的中文网页都介绍,要修改Tomcat的默认最大并发连接数,应该进行如下设置(实际上这些步骤是错误的): -------------------------------------------- ...

  5. python编写网络抓包分析脚本

    python编写网络抓包分析脚本 写网络抓包分析脚本,一个称手的sniffer工具是必不可少的,我习惯用Ethereal,简单,易用,基于winpcap的一个开源的软件 Ethereal自带许多协议的 ...

  6. 【Java线程】volatile的适用场景

    http://www.ibm.com/developerworks/cn/java/j-jtp06197.html 把代码块声明为 synchronized,有两个重要后果,通常是指该代码具有 原子性 ...

  7. DRP——Servlet(一)

    Servlet Servlet是用java语言编写的程序,执行在Webserver上,用来处理来自client的请求:通常会把处理的结果以HTML的形式返回,在client形成动态网页.事实上能够理解 ...

  8. 开源解析器--ANTLR

      序言 有的时候,我还真是怀疑过上本科时候学的那些原理课究竟是不是在浪费时间.比方学完操作系统原理之后我们并不能自己动手实现一个操作系统:学完数据库原理我们也不能弄出个像样的DBMS出来:相同,学完 ...

  9. 安装Linux_[CentOS]系统

    Lunx操作系统安装 虚拟机:VirtualBox. 操作系统的选择:CentOS 6.3. (64位/32位都可). (CentOS:诞生于社区的企业级操作系统). Install Or Upgra ...

  10. 实现StatusBar的Flat风格

    效果见右图,OfficeXP里就是这样的风格,其实实现很简单,不必专门在网上找别人控件. 把StatusBar的SimplePanel设为False,点击Panels添加StatusPanel,把所有 ...