<bdo id='rYM0D'></bdo><ul id='rYM0D'></ul>

    <legend id='rYM0D'><style id='rYM0D'><dir id='rYM0D'><q id='rYM0D'></q></dir></style></legend>

    <small id='rYM0D'></small><noframes id='rYM0D'>

    <i id='rYM0D'><tr id='rYM0D'><dt id='rYM0D'><q id='rYM0D'><span id='rYM0D'><b id='rYM0D'><form id='rYM0D'><ins id='rYM0D'></ins><ul id='rYM0D'></ul><sub id='rYM0D'></sub></form><legend id='rYM0D'></legend><bdo id='rYM0D'><pre id='rYM0D'><center id='rYM0D'></center></pre></bdo></b><th id='rYM0D'></th></span></q></dt></tr></i><div id='rYM0D'><tfoot id='rYM0D'></tfoot><dl id='rYM0D'><fieldset id='rYM0D'></fieldset></dl></div>

    <tfoot id='rYM0D'></tfoot>

      performSegueWithIdentifier 和 sharedData

      时间:2023-05-30
      <tfoot id='wtLWN'></tfoot>

        <bdo id='wtLWN'></bdo><ul id='wtLWN'></ul>

          • <legend id='wtLWN'><style id='wtLWN'><dir id='wtLWN'><q id='wtLWN'></q></dir></style></legend>

              <tbody id='wtLWN'></tbody>
              <i id='wtLWN'><tr id='wtLWN'><dt id='wtLWN'><q id='wtLWN'><span id='wtLWN'><b id='wtLWN'><form id='wtLWN'><ins id='wtLWN'></ins><ul id='wtLWN'></ul><sub id='wtLWN'></sub></form><legend id='wtLWN'></legend><bdo id='wtLWN'><pre id='wtLWN'><center id='wtLWN'></center></pre></bdo></b><th id='wtLWN'></th></span></q></dt></tr></i><div id='wtLWN'><tfoot id='wtLWN'></tfoot><dl id='wtLWN'><fieldset id='wtLWN'></fieldset></dl></div>

                <small id='wtLWN'></small><noframes id='wtLWN'>

                本文介绍了performSegueWithIdentifier 和 sharedData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我希望我问的不是已经回答的问题(但我没有找到答案,所以希望我没有).

                I hope I'm not asking something that's been already answered (but I found no answer to this, so hopefully I'm not).

                我在当前的 xcode 版本中有一个应用程序,使用 segues 和 navigationController.我需要将数据从一个视图传递到另一个视图 - 最简单的方法是什么?我遇到了一些可能与 performSegueWithIdentifier 方法挂钩的 sharedData 东西,但不知道如何使用它(或者这样做是否是正确的选择).

                I have an app in the current xcode version, using segues and navigationController. I need to pass data from one view to the other - what's the easiest way to do this? I ran onto some sharedData thing that could be possibly hooked onto the performSegueWithIdentifier method but don't know how to use it (or whether it is the right choice to do it like this).

                谢谢

                推荐答案

                一个segue有两个视图控制器:sourceViewControllerdestinationViewController.当 UIKit 执行 segue 时,它​​会向源 VC 发送 prepareForSegue:sender: 消息.您可以在视图控制器子类中重写该方法以将数据传递给目标 VC.

                A segue has two view controllers: sourceViewController and destinationViewController. When UIKit executes a segue, it sends a prepareForSegue:sender: message to the source VC. You can override that method in your view controller subclass to pass data to the destination VC.

                例如,假设您有一个带有电影表视图的主视图控制器,并且当用户单击表视图中的一行时,您希望转到电影的详细视图控制器.

                For example, suppose you have a master view controller with a table view of movies, and when the user clicks a row in the table view, you want to segue to a detail view controller for the movie.

                @implementation MasterViewController
                
                ...
                
                - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
                {
                    DetailViewController *detailVC = segue.destinationViewController;
                    NSIndexPath *selectedPath = [self.tableView indexPathForSelectedRow];
                    detailVC.movie = [self movieForIndexPath:selectedPath];
                }
                

                Interface Builder Storyboard 简介中对此进行了解释来自 WWDC 2011 的视频.

                This is explained in the Introducing Interface Builder Storyboarding video from WWDC 2011.

                另外值得注意的是,当segue的来源是table view cell,或者table view cell的附属按钮时,prepareForSegue:sender:sender参数是表格视图单元格.

                It's also worth noting that when the segue's origin is a table view cell, or the accessory button of a table view cell, the sender argument of prepareForSegue:sender: is the table view cell.

                这篇关于performSegueWithIdentifier 和 sharedData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:将 UIPopoverController 呈现在相同位置,仅更改箭头 下一篇:在应用程序启动时从情节提要中选择替代的第一

                相关文章

                最新文章

                  <i id='zIfM8'><tr id='zIfM8'><dt id='zIfM8'><q id='zIfM8'><span id='zIfM8'><b id='zIfM8'><form id='zIfM8'><ins id='zIfM8'></ins><ul id='zIfM8'></ul><sub id='zIfM8'></sub></form><legend id='zIfM8'></legend><bdo id='zIfM8'><pre id='zIfM8'><center id='zIfM8'></center></pre></bdo></b><th id='zIfM8'></th></span></q></dt></tr></i><div id='zIfM8'><tfoot id='zIfM8'></tfoot><dl id='zIfM8'><fieldset id='zIfM8'></fieldset></dl></div>
                  <tfoot id='zIfM8'></tfoot>
                    • <bdo id='zIfM8'></bdo><ul id='zIfM8'></ul>

                    <legend id='zIfM8'><style id='zIfM8'><dir id='zIfM8'><q id='zIfM8'></q></dir></style></legend>

                  1. <small id='zIfM8'></small><noframes id='zIfM8'>