Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在iPad的DetailViewController中加载其他视图_Iphone_Xcode_Ipad - Fatal编程技术网

Iphone 如何在iPad的DetailViewController中加载其他视图

Iphone 如何在iPad的DetailViewController中加载其他视图,iphone,xcode,ipad,Iphone,Xcode,Ipad,如何在单击一个按钮时将Nib文件中的视图加载到iPad的DetailView中,然后在另一个按钮单击时返回到上一个视图在子视图中显示。我发现这个站点很有用: 以下代码应该会引导您朝着正确的方向前进 要加载新的ViewController,请执行以下操作: - (IBAction)myBtnPushed{ NSLog(@"myBtnPushed"); NewRightVC *newRightVC = [[NewRightVC alloc] initWithNibName:@"NewRightVC

如何在单击一个按钮时将Nib文件中的视图加载到iPad的DetailView中,然后在另一个按钮单击时返回到上一个视图在子视图中显示。

我发现这个站点很有用:


以下代码应该会引导您朝着正确的方向前进

要加载新的ViewController,请执行以下操作:

- (IBAction)myBtnPushed{
NSLog(@"myBtnPushed");

NewRightVC *newRightVC = [[NewRightVC alloc] initWithNibName:@"NewRightVC" bundle:[NSBundle mainBundle]];
[detailViewController.navigationController pushViewController:newRightVC animated:YES];

NewLeftVC *newLeftVC = [[NewLeftVC alloc] initWithNibName:@"NewLeftVC" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:newLeftVC animated:YES];
}
[detailViewController.navigationController popViewControllerAnimated:YES];

[self.navigationController popViewControllerAnimated:YES];
要返回UISplitViewController中的RootViewController和DefaultViewController,请执行以下操作:

- (IBAction)myBtnPushed{
NSLog(@"myBtnPushed");

NewRightVC *newRightVC = [[NewRightVC alloc] initWithNibName:@"NewRightVC" bundle:[NSBundle mainBundle]];
[detailViewController.navigationController pushViewController:newRightVC animated:YES];

NewLeftVC *newLeftVC = [[NewLeftVC alloc] initWithNibName:@"NewLeftVC" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:newLeftVC animated:YES];
}
[detailViewController.navigationController popViewControllerAnimated:YES];

[self.navigationController popViewControllerAnimated:YES];