Scenes

Scenes in a storyboard represent content shown within one screen in your application. A scene involves a view controller and the views that make up its interface.

There’s also no limit as to how many scenes you can have within one storyboard.

If you have many scenes that are
part of a distinctly different part of your application, you could also separate them out
into another storyboard file.

Separate storyboards can be loaded programmatically.

eg, if you had a storyboard file named OtherStoryboard.storyboard, you
could load it by using the following command:

UIStoryboard *newStoryboard = [UIStoryboard storyboardWithName:@"OtherStoryboard" bundle:nil];

Segues

Segues allow you to easily transition from scene to scene. Segues are represented by
the UIStoryboardSegue class.

There are a few built-in segues that you can choose from. When working with an
iPhone application you can choose from push, modal, or custom. For the iPad you’re
given an extra choice of using a popover segue.

Modal segues slide a scene from the bottom to the top and appear to be on top
of the parent scene. You used a modal segue when showing your scene to create a
new task.

Push segues are used to transition the new scene in from the right. In
a push segue the original scene that prompted the segue then goes away by sliding
out to the left. You used this type of segue when tapping on a task from the tasks list
to show the task view.
Popover segues overlay only part of the parent view within a popover.
You can create custom segues by creating your own UIStoryboardSegue class. This
gives you full control over the transition and appearance of the new scene.

You create segues in your storyboard by using your mouse to drag a connection
from one scene or an actionable object to another.

// trigger it when a row in your table view was selected
-(void) tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"taskSegue"
sender:self.tasks[indexPath.row]];
}

Passing data between view controllers with segues

Segues also allow you to pass data to the next view controller before completing the
transition. You do this by overriding the prepareForSegue:sender: method from
the originating view controller:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
UIViewController *destination = segue.destinationViewController;
// Check to see if you’re preparing for the correct segue
if ([segue.identifier isEqualToString:@"taskSegue"])
// Setting the sender as the task property
[destination setValue:sender forKeyPath:@"task"];
else
// Get destination controller if not taskSegue
destination = [segue.destinationViewController topViewController];


// Set your current view controller as the delegate property
[destination setValue:self forKeyPath:@"delegate"];
}

Problems with using storyboarding

1) multiple team members development

The biggest problem with storyboarding is that it’s extremely difficult to use when
working with a team that uses source code revision and management tools like Git,
Subversion, or Mercurial.

When multiple teammates make changes to the same storyboard,
it becomes problematic. Source code revision tools won’t be able to properly merge
the changes, and Xcode won’t be able to open the storyboard file until the changes
have been merged successfully. You’ll be forced to do a deep dive into the XML to fix
it yourself.

2) Another problem is that it forces older developers, who have been comfortable
using NIBs and creating and managing views programmatically, to change their
ways.

scenes & segues within storyboards的更多相关文章

  1. iphone dev 入门实例1:Use Storyboards to Build Table View

    http://www.appcoda.com/use-storyboards-to-build-navigation-controller-and-table-view/ Creating Navig ...

  2. 转换到 StoryBoard 的公布说明(Converting to Storyboards Release Notes)

    转换到 StoryBoard 的公布说明(Converting to Storyboards Release Notes) 太阳火神的漂亮人生 (http://blog.csdn.net/opengl ...

  3. Storyboards Tutorial 01

    Storyboarding 是在ios 5时候引进入的一个非常出色的特性.节省了为app创建user interfaces的时间.

  4. 【Xamarin Doc】 Introduction to Storyboards 笔记

    http://developer.xamarin.com/guides/ios/user_interface/introduction_to_storyboards/ Segues There are ...

  5. Storyboards vs NIB vs Code 大辩论

    前言 做iOS开发的童鞋都应该会纠结一个问题,那就是在做开发的时候是使用StoryBoard还是使用Nibs又或者是Code(纯代码流)呢?笔者也非常纠结这个问题,今天碰巧在raywenderlich ...

  6. 论文阅读(Xiang Bai——【CVPR2015】Symmetry-Based Text Line Detection in Natural Scenes)

    Xiang Bai--[CVPR2015]Symmetry-Based Text Line Detection in Natural Scenes 目录 作者和相关链接 方法概括 创新点和贡献 方法细 ...

  7. Xcode5中如何切换Storyboards为xib

    在Xcode5中,当创建一个带View的iPhone项目时,默认必须使用Storyboards,不再支持切换xib的checkbox.本文讲解如何手动切换到使用xib来布局. 1,把Main.stor ...

  8. Storyboards

    这里是吐槽时间,换掉了mac默认的输入法,出发点只有一个,就是切换中英文输入的时候相当不爽.也许是习惯了其他各大输入法的一键切换,而又没有找到自带输入法可设置的地方. Segue 以前我们使用navi ...

  9. Animating Views Using Scenes and Transitions

    From android 4.4 , it supply one new animation with layout:transition To help you animate a change b ...

随机推荐

  1. 使用命令行设置svn忽略列表

    Windows 上的 TortoiseSVN 设置 svn 的忽略列表是非常方便的,但是在Mac OS X上,好用的图形化 svn 客户端都有点儿贵,比如 Versions 和 CornerStone ...

  2. 错误记录:html隐藏域的值存字符串时出错

    问题 webform在后台给前台传值.  <input type="hidden" value="<%=userType %>" id=&qu ...

  3. C ~ C语言字节对齐

    1. 什么是对齐? 现代计算机中内存空间都是按照字节(byte)划分的,从理论上讲似乎对任何类型的变量的访问可以从任何地址开始,但实际情况是在访问特定变量的时候经常在特定的内存地址访问,这就需要各类型 ...

  4. dll 打包

    开发程序的时候经常会引用一些第三方的DLL,然后编译生成的exe文件就不能脱离这些DLL独立运行了. 但是,很多时候我们本想开发一款只需要一个exe就能完美运行的小工具.那该怎么办呢? 下文介绍一种超 ...

  5. ansibleplaybook的使用

    1.简单格式要求 [root@ansibleserver ansible]# cat nagios.yml --- - hosts: nagiosserver tasks: - name: ensur ...

  6. 数往知来 CSS<十二>

    div+css基础 一.外部样式<!--外部样式可以使网页与样式分离,分工处理 1.写网页,主要提供内容,一般都会有固定的结构,具有id等属性的标签包括特定的内容 2.根据结构写样式另存为css ...

  7. JS简单入门教程

    JS简单教程 使用方法:放到任意html页面的head标签下 Test1方法弹出当前时间对话框 Test2方法for循环输出 Test3方法for(…in…)输出数组内容 <script typ ...

  8. Web服务器与Servlet容器

    今日要闻: Oracle启动了JRE7到JRE8的自动更新, JRE8发布于2014.3,于2014.10成为java.com默认版本, JRE7发布于2011.7, Oracle指定的Java生命政 ...

  9. Hadoop2.2 federnation联盟的搭建

    联盟实际上是一个单独的集群,集群里面包含很多的NameService共享同样的DataNode,同一份数据只上传一份,block块相同,一个集群中删除,另一个集群中还是存在的.同一份数据只是在name ...

  10. Hadoop2.2.0 自动切换HA环境搭建

    自动切换的HA,比手动切换HA集群多了一个zookeeper集群 机器分配: zookeeper:hadoop4,hadoop5,hadoop6 namenode:hadoop4,hadoop5 da ...