<tfoot id='i6m1t'></tfoot>
    1. <small id='i6m1t'></small><noframes id='i6m1t'>

    2. <legend id='i6m1t'><style id='i6m1t'><dir id='i6m1t'><q id='i6m1t'></q></dir></style></legend>

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

        为什么这段代码使用 presentModalViewController?(不是 pushViewController)

        why does this code use presentModalViewController? (not pushViewController)(为什么这段代码使用 presentModalViewController?(不是 pushViewController))
        <legend id='mxM22'><style id='mxM22'><dir id='mxM22'><q id='mxM22'></q></dir></style></legend>

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

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

            • <tfoot id='mxM22'></tfoot>
                  <bdo id='mxM22'></bdo><ul id='mxM22'></ul>

                    <tbody id='mxM22'></tbody>
                • 本文介绍了为什么这段代码使用 presentModalViewController?(不是 pushViewController)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  任何人都明白为什么在 CoreDataBooks 示例代码中:

                  Anyone understand why in the CoreDataBooks example code that:

                  (a) 控制器交换差异的方法

                  虽然单击项目并转到详细视图使用似乎是pushViewController"的标准 UINavigationController 概念,但当您单击添加"新记录按钮时,它会启动通过presentModalViewController"方法添加记录的新视图?也就是说,这两种情况下的方法不能相同,只是使用 pushViewController 方法吗?

                  Whilst the click an item and go to detailed view uses what seems to be the standard UINavigationController concept of "pushViewController", that when when you click on the "Add" a new record button it launches the new view to add the record via "presentModalViewController" approach? That is, couldn't the approach have been the same in both cases, just using a pushViewController approach?

                  在使用每种方法的地方使用每种方法实际上有什么好处吗?我看不太清楚.我猜苹果一定有一些东西可以为不同的场景选择这些不同的方法.例如:

                  Are there actually any advantages to using each approach for where it's been used? I can't quite see. I'd guess there must have been something for Apple to choose these different approaches for different scenarios. For example:

                  1. 对用户的任何差异(即UI 差异或功能差异)他们会看到?

                  1. any differences to the user (i.e. UI differences or functional differences) that they would see?

                  开发者的任何差异(或优点/缺点)

                  any differences for the developer (or advantages/disadvantages)

                  例如,如果您要考虑在添加"场景中使用 pushViewController 方法而不是 presentModalViewController 方法...

                  For example, if you were to consider using pushViewController approach instead of the presentModalViewController approach for the for the "Add" scenario...

                  (b) 数据共享方式差异

                  他们共享公共数据对象的方法似乎不同 - 所以再次想知道为什么方法不一样?(即在这两种情况下,主控制器都暂时传递给另一个视图,并且它们之间存在一些共享数据 - 即子视图需要传递回父视图)

                  the approach to how they share the common data object seems to be different - so again just wondering why the approaches weren't the same? (i.e. in both cases the main controller is passing off to another view temporarily and there is some shared data between them - i.e. that the child view needs to pass back to the parent)

                  代码提取方便

                  那是编辑":

                  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
                      // Create and push a detail view controller.
                      DetailViewController *detailViewController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped];
                      Book *selectedBook = (Book *)[[self fetchedResultsController] objectAtIndexPath:indexPath];
                  
                      // Pass the selected book to the new view controller.
                      detailViewController.book = selectedBook;
                      [self.navigationController pushViewController:detailViewController animated:YES];
                      [detailViewController release];
                  }
                  

                  但是对于添加"

                  - (IBAction)addBook {
                      AddViewController *addViewController = [[AddViewController alloc] initWithStyle:UITableViewStyleGrouped];
                       addViewController.delegate = self;
                  
                       // Create a new managed object context for the new book -- set its persistent store coordinator to the same as that from the fetched results controller's context.
                       NSManagedObjectContext *addingContext = [[NSManagedObjectContext alloc] init];
                       self.addingManagedObjectContext = addingContext;
                       [addingContext release];
                  
                       [addingManagedObjectContext setPersistentStoreCoordinator:[[fetchedResultsController managedObjectContext] persistentStoreCoordinator]];
                       addViewController.book = (Book *)[NSEntityDescription insertNewObjectForEntityForName:@"Book" inManagedObjectContext:addingContext];
                       UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:addViewController];
                          [self.navigationController presentModalViewController:navController animated:YES];
                  
                       [addViewController release];
                       [navController release];
                  
                  }
                  

                  谢谢

                  推荐答案

                  您使用模态视图控制器将用户的注意力集中在一个任务上.当您推送时,用户处于某种导航流程中,但仍然触手可及整个应用程序.他们可能决定前进或后退,切换到中间的不同选项卡,无论如何.当他们获得模态视图控制器时,他们无法执行任何操作,直到任务完成或取消(模态视图被解除)

                  You use modal view controllers to focus the user's attention on a Task. When you push, the user is in some kind of navigation flow, but still has the total application at their fingertips. They might decide to go forward or backward, switch to a different tab in the middle, whatever. When they get a modal view controller, they can't do any of that until the task is completed or canceled out of (the modal view is dismissed)

                  这篇关于为什么这段代码使用 presentModalViewController?(不是 pushViewController)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to add a navigation controller programmatically in code but not as initial view controller(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                  How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)

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

                              <tbody id='VkekI'></tbody>
                          1. <small id='VkekI'></small><noframes id='VkekI'>