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

    1. <tfoot id='kxY29'></tfoot>

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

          <bdo id='kxY29'></bdo><ul id='kxY29'></ul>
        <i id='kxY29'><tr id='kxY29'><dt id='kxY29'><q id='kxY29'><span id='kxY29'><b id='kxY29'><form id='kxY29'><ins id='kxY29'></ins><ul id='kxY29'></ul><sub id='kxY29'></sub></form><legend id='kxY29'></legend><bdo id='kxY29'><pre id='kxY29'><center id='kxY29'></center></pre></bdo></b><th id='kxY29'></th></span></q></dt></tr></i><div id='kxY29'><tfoot id='kxY29'></tfoot><dl id='kxY29'><fieldset id='kxY29'></fieldset></dl></div>
      1. 带有两个 NavigationController 链接协议的 splitViewController

        时间:2023-06-12
      2. <tfoot id='wGMpw'></tfoot>

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

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

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

                  本文介绍了带有两个 NavigationController 链接协议的 splitViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  添加源项目

                  --> 我上传了一个示例项目,它清楚地显示了我的困境,可以在这里找到 <--

                  我创建了一个基于拆分视图的应用程序.然后,我在 MainWindow.xib 中的 DetailViewController 中添加了第二个 UINavigationController.

                  I created a Split View-based Application. I then added a second UINavigationController to the DetailViewController inside the MainWindow.xib.

                  然后,当单击工具栏项时,我会弹出一个新的 UIViewController 子类.我使用以下代码进行弹出:

                  I then pop a new UIViewController Subclasses when a toolbar item is clicked. I use the following code to conduct the pop:

                  DocumentDetailVC *DetailViewController = [[DocumentDetailVC alloc] initWithNibName:@"DocumentDetailVC" bundle:[NSBundle mainBundle]];
                  [detailViewController.detailNavController pushViewController:DetailViewController animated:YES];
                  
                  DocumentsVC *RRequestViewController = [[DocumentsVC alloc] initWithNibName:@"DocumentsVC" bundle:[NSBundle mainBundle]];
                  [self.navigationController pushViewController:RRequestViewController animated:YES];
                  

                  这行得通.我遇到的问题是如何将信息或函数调用从拆分视图的主侧传递到拆分视图的详细信息侧?

                  This works. The issue I am having is how do I pass information or function calls from the Main side of the Split View to the Detail side of the Split view?

                  如果我通过以下方法呈现 UIViewController:

                  If I present the UIViewController via the following method:

                  DocumentDetailVC *RRequestViewController = [[DocumentDetailVC alloc] initWithNibName:@"DocumentDetailVC" bundle:[NSBundle mainBundle]];
                  RRequestViewController.delegate=self;
                  RRequestViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
                  [RRequestViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
                  [self presentModalViewController:RRequestViewController animated:YES];
                  [RRequestViewController release];
                  RRequestViewController = nil;
                  

                  我能够按预期通过协议完成回访.

                  I am able to complete a reach back through a protocol as intended.

                  DocumentDetailVC,通过pushViewController加载时,层次结构如下:

                  DocumentDetailVC, when loaded via the pushViewController, the hierarchy is as follows:

                  NSLog([NSString stringWithFormat:@"%@",self]); 
                  //self = <DocumentDetailVC: 0x4e0d960>
                  NSLog([NSString stringWithFormat:@"%@",self.parentViewController]);
                  //self.parentViewController = <UINavigationController: 0x4e0ce30>
                  NSLog([NSString stringWithFormat:@"%@",self.parentViewController.parentViewController]);
                  //self.parentViewController.parentViewController = <UISplitViewController: 0x4e0d0f0>
                  

                  感谢您的帮助.这个问题正在消耗我的生命!

                  Thank you for your assistance. This problem is consuming my life!

                  --> 我上传了一个示例项目,它清楚地显示了我的困境,可以在这里找到 <--

                  推荐答案

                  好的,我知道答案很晚,但我认为这个答案是完美且有效的.试试看.打开你的 RootViewController.h,在顶部写下这一行:

                  Ok, I know am very late for answer but this answer is, I think, perfect and working. Try it. Open your RootViewController.h, on the top write this line:

                  #import "Left.h"
                  #import "Right.h"
                  

                  在@interface RootViewController 中写下这一行

                  in @interface RootViewController write this lines

                  Left *lefty;
                  Right *righty;
                  

                  之后将属性声明为,

                  @property (nonatomic, retain) Left *lefty;
                  @property (nonatomic, retain) Right *righty;
                  

                  去ROOTVIEWCONTROLLER.M文件合成为,

                  go to ROOTVIEWCONTROLLER.M file synthesize as,

                  @synthesize lefty;
                  @synthesize righty;
                  

                  然后在 RootViewController.m 中用这个替换你的函数

                  after that in RootViewController.m just replace your function with this one

                      - (IBAction)myBtnPushed{
                      NSLog(@"myBtnPushed");
                  
                  
                      lefty = [[Left alloc] initWithNibName:@"Left" bundle:[NSBundle mainBundle]];
                      righty = [[Right alloc] initWithNibName:@"Right" bundle:[NSBundle mainBundle]];
                  
                      lefty.delegate=righty;
                      [self.navigationController pushViewController:lefty animated:YES];
                  
                      [detailViewController.navigationController pushViewController:righty animated:YES];
                  
                  
                  }
                  

                  在delloac写这个,

                  in delloac write this,

                  [lefty release];
                  lefty = nil;
                  [righty release];
                  righty = nil;
                  

                  完成,运行您的应用程序.我测试了,完成了.

                  It's done, run your app. I tested, it's done.

                  这篇关于带有两个 NavigationController 链接协议的 splitViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 UINavigationController 中推送另一个视图? 下一篇:如何使 UINavigationBar 背景透明?

                  相关文章

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

                      <tfoot id='7ERPw'></tfoot>

                    1. <small id='7ERPw'></small><noframes id='7ERPw'>