scenes & segues within storyboards

简介: 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.

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.

 

目录
相关文章
|
6月前
分层模型的优点
分层模型的优点。
134 0
|
2天前
|
存储 人工智能 弹性计算
阿里云弹性计算_加速计算专场精华概览 | 2024云栖大会回顾
2024年9月19-21日,2024云栖大会在杭州云栖小镇举行,阿里云智能集团资深技术专家、异构计算产品技术负责人王超等多位产品、技术专家,共同带来了题为《AI Infra的前沿技术与应用实践》的专场session。本次专场重点介绍了阿里云AI Infra 产品架构与技术能力,及用户如何使用阿里云灵骏产品进行AI大模型开发、训练和应用。围绕当下大模型训练和推理的技术难点,专家们分享了如何在阿里云上实现稳定、高效、经济的大模型训练,并通过多个客户案例展示了云上大模型训练的显著优势。
|
5天前
|
存储 人工智能 调度
阿里云吴结生:高性能计算持续创新,响应数据+AI时代的多元化负载需求
在数字化转型的大潮中,每家公司都在积极探索如何利用数据驱动业务增长,而AI技术的快速发展更是加速了这一进程。
|
2天前
|
人工智能 运维 双11
2024阿里云双十一云资源购买指南(纯客观,无广)
2024年双十一,阿里云推出多项重磅优惠,特别针对新迁入云的企业和初创公司提供丰厚补贴。其中,36元一年的轻量应用服务器、1.95元/小时的16核60GB A10卡以及1元购域名等产品尤为值得关注。这些产品不仅价格亲民,还提供了丰富的功能和服务,非常适合个人开发者、学生及中小企业快速上手和部署应用。
|
10天前
|
人工智能 弹性计算 文字识别
基于阿里云文档智能和RAG快速构建企业"第二大脑"
在数字化转型的背景下,企业面临海量文档管理的挑战。传统的文档管理方式效率低下,难以满足业务需求。阿里云推出的文档智能(Document Mind)与检索增强生成(RAG)技术,通过自动化解析和智能检索,极大地提升了文档管理的效率和信息利用的价值。本文介绍了如何利用阿里云的解决方案,快速构建企业专属的“第二大脑”,助力企业在竞争中占据优势。
|
12天前
|
自然语言处理 数据可视化 前端开发
从数据提取到管理:合合信息的智能文档处理全方位解析【合合信息智能文档处理百宝箱】
合合信息的智能文档处理“百宝箱”涵盖文档解析、向量化模型、测评工具等,解决了复杂文档解析、大模型问答幻觉、文档解析效果评估、知识库搭建、多语言文档翻译等问题。通过可视化解析工具 TextIn ParseX、向量化模型 acge-embedding 和文档解析测评工具 markdown_tester,百宝箱提升了文档处理的效率和精确度,适用于多种文档格式和语言环境,助力企业实现高效的信息管理和业务支持。
3933 2
从数据提取到管理:合合信息的智能文档处理全方位解析【合合信息智能文档处理百宝箱】
|
1天前
|
算法 安全 网络安全
阿里云SSL证书双11精选,WoSign SSL国产证书优惠
2024阿里云11.11金秋云创季活动火热进行中,活动月期间(2024年11月01日至11月30日)通过折扣、叠加优惠券等多种方式,阿里云WoSign SSL证书实现优惠价格新低,DV SSL证书220元/年起,助力中小企业轻松实现HTTPS加密,保障数据传输安全。
480 3
阿里云SSL证书双11精选,WoSign SSL国产证书优惠
|
8天前
|
安全 数据建模 网络安全
2024阿里云双11,WoSign SSL证书优惠券使用攻略
2024阿里云“11.11金秋云创季”活动主会场,阿里云用户通过完成个人或企业实名认证,可以领取不同额度的满减优惠券,叠加折扣优惠。用户购买WoSign SSL证书,如何叠加才能更加优惠呢?
979 2
|
5天前
|
算法 数据建模 网络安全
阿里云SSL证书2024双11优惠,WoSign DV证书220元/年起
2024阿里云11.11金秋云创季火热进行中,活动月期间(2024年11月01日至11月30日),阿里云SSL证书限时优惠,部分证书产品新老同享75折起;通过优惠折扣、叠加满减优惠券等多种方式,阿里云WoSign SSL证书将实现优惠价格新低,DV SSL证书220元/年起。
555 5
|
6天前
|
机器学习/深度学习 存储 人工智能
白话文讲解大模型| Attention is all you need
本文档旨在详细阐述当前主流的大模型技术架构如Transformer架构。我们将从技术概述、架构介绍到具体模型实现等多个角度进行讲解。通过本文档,我们期望为读者提供一个全面的理解,帮助大家掌握大模型的工作原理,增强与客户沟通的技术基础。本文档适合对大模型感兴趣的人员阅读。
333 15
白话文讲解大模型| Attention is all you need