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. MySQL定期分析检查与优化表

    定期分析表   ANALYZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name]   本语句用于分析和存储表的关键字分布.在分析期间,使 ...

  2. ORACLE TM锁

    Oracle的TM锁类型 锁模式 锁描述 解释 SQL操作 0 none 1 NULL 空 Select 2 SS(Row-S) 行级共享锁,其他对象只能查询这些数据行 Select for upda ...

  3. eclipse手动导入dtd文件

    1.在eclipse的工具栏上按照“Window->Preferences->XML->XML Catalog”依次点下去,然后在右侧选中 User Specified Entrie ...

  4. MySQL_PHP学习笔记_2015_0923_MySQL如何开启事件

    1. 查看事件状态>>>>>>>>>>>>>>>>>>>>>>> ...

  5. WebGoat学习——SQL注入(SQL Injection)

    SQL注入(SQL Injection) 所谓SQL注入式攻击,就是攻击者把SQL命令插入到Web表单的输入域或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令.攻击者通过web请求提交带有影响正 ...

  6. c++11之智能指针

    在c++98中,智能指针通过一个模板“auto_ptr”来实现,auto_ptr以对象的方式来管理堆分配的内存,在适当的时间(比如析构),释放所获得的内存.这种内存管理的方式只需要程序员将new操作返 ...

  7. 装饰模式decorator

    C++设计模式——装饰模式 前言 在实际开发时,你有没有碰到过这种问题:开发一个类,封装了一个对象的核心操作,而这些操作就是客户使用该类时都会去调用的操作:而有一些非核心的操作,可能会使用,也可能不会 ...

  8. 【24点游戏】cocos2dx 源码

    1.  4个数字 24点判断 double Calc(double a, double b, string oper) { double result = 0; const char *p = ope ...

  9. PySpark操作HBase时设置scan参数

    在用PySpark操作HBase时默认是scan操作,通常情况下我们希望加上rowkey指定范围,即只获取一部分数据参加运算.翻遍了spark的python相关文档,搜遍了google和stackov ...

  10. 消息队列与RabbitMQ

    1 什么是消息队列 消息指进程或应用间通信的数据:队列是保存数据的结构:消息队列是指进程或应用间通信时,保存消息的容器.消息队列独特的机制和结构保证了消息发送者和接收者之间良好的异步通信. 2 为什么 ...