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. PHP - 图像处理

    第14章 处理图像 学习要点: 1.创建图像 2.简单小案例 在PHP5中,动态图象的处理要比以前容易得多.PHP5在php.ini文件中包含了GD扩展包,只需去掉GD扩展包的相应注释就可以正常使用了 ...

  2. 利用Winscp,Putty实现Windows下编写Linux程序

    本文讲的方案实现以下功能:利用winscp和putty的脚本功能,实现在Window平台上编写代码,上传到Linux进行编译,然后取编译结果.需要用到3个文件,分别如下: (1) synchroniz ...

  3. SQL Server 2008中文企业版下载地址和序列号[转]

    SQLSERVER2008下载链接http://sqlserver.dlservice.microsoft.com/dl/download/B/8/0/B808AF59-7619-4A71-A447- ...

  4. ASP.NET 4.5 Bundle组件(捆绑、缩小静态文件)

    阅读目录: 1.开篇介绍 2.System.Web.Optimization 组件 3.System.Web.Optimization 组件基本原理 4.扩展自定义类型静态文件 1]开篇介绍 这篇文章 ...

  5. Android 点亮屏幕

    前言          欢迎大家我分享和推荐好用的代码段~~ 声明          欢迎转载,但请保留文章原始出处:          CSDN:http://www.csdn.net        ...

  6. 基于visual Studio2013解决C语言竞赛题之1061最大值和次最大值

       题目 解决代码及点评 /* 功能: 编写子函数, 求一维整型数组M[10]的最大值及次最大值(次最大值可能不存在). 主函数中输入10个整数, 然后调用上述子函数, 若次最大值存在, ...

  7. css盒模型和块级、行内元素深入理解

    盒模型是CSS的核心知识点之一,它指定元素如何显示以及如何相互交互.页面上的每个元素都被看成一个矩形框,这个框由元素的内容.内边距.边框和外边距组成,需要了解的朋友可以深入参考下 一.CSS盒模型 盒 ...

  8. HTTP协议结构

    HTTP报文=从客户机到服务器的请求+从服务器到客户机的响应 1.请求报文的格式如下: 请求头   通用信息头    请求头    实体头    报文主体 请求行的格式为: Method[分隔符]Re ...

  9. php语言基础学习笔记

    花了一个小时复习了一下很多年没有碰了的php,mark一下,高二时学的. 1. 代码嵌在<?php  ?>内 2.输出函数echo,相当于js中的document.write 3.可以在打 ...

  10. 设计模式6:Composite

    Entry.java: package gendwang.cisco.com; public abstract class Entry { private int height = 0; privat ...