Iphone 具有两个NavigationController链接协议的splitViewController
编辑:添加源项目Iphone 具有两个NavigationController链接协议的splitViewController,iphone,uinavigationcontroller,uisplitviewcontroller,ipad,Iphone,Uinavigationcontroller,Uisplitviewcontroller,Ipad,编辑:添加源项目 -->我上传了一个样本项目,它清楚地显示了我的困境,可以在这里找到。我上传了一个样本项目,它清楚地显示了我的困境,可以在这里找到好的,我知道答案已经很晚了,但我认为这个答案是完美的,有效的。试试看。打开RootViewController.h,在顶部写下以下行: #import "Left.h" #import "Right.h" 在@interface RootViewController中写入以下行 Left *lefty; Right *righty; 之后,宣布财产
-->我上传了一个样本项目,它清楚地显示了我的困境,可以在这里找到。我上传了一个样本项目,它清楚地显示了我的困境,可以在这里找到好的,我知道答案已经很晚了,但我认为这个答案是完美的,有效的。试试看。打开RootViewController.h,在顶部写下以下行:
#import "Left.h"
#import "Right.h"
在@interface RootViewController中写入以下行
Left *lefty;
Right *righty;
之后,宣布财产为
@property (nonatomic, retain) Left *lefty;
@property (nonatomic, retain) Right *righty;
转到ROOTVIEWCONTROLLER.M文件,如下所示:
@synthesize lefty;
@synthesize righty;
在RootViewController.m中,然后用这个函数替换你的函数
- (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写下这个
[lefty release];
lefty = nil;
[righty release];
righty = nil;
完成后,运行你的应用程序。我测试过了,完成了
@synthesize lefty;
@synthesize righty;
- (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];
}
[lefty release];
lefty = nil;
[righty release];
righty = nil;