我目前有一个想要添加标签栏的 MasterDetail 视图应用程序。我已成功将选项卡栏添加到主表视图,并且我将表视图设置为另一个选项卡。这是有效的,但我的问题是:
如果我想在另一个选项卡上有另一个 MasterDetail 视图,我会在选项卡栏控制器中添加一个 SplitView 控制器吗?还是我只是添加一个表格视图控制器,将其调整为 Master,然后添加一个 UIView 并将其调整为详细信息并通过 segue 推送所有数据?
可能是一个愚蠢的问题,但我还没有看到任何答案。
*编辑*
到目前为止,这是我的 AppDelegate.m 的内容:
#import "AppDelegate.h"
#import "LeftViewController.h"
#import "RightViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
UINavigationController *leftNavController = [(UITabBarController *)splitViewController.viewControllers[0] viewControllers][0];
LeftViewController *leftViewController = (LeftViewController *)[leftNavController topViewController];
UINavigationController *rightNavController = [splitViewController.viewControllers objectAtIndex:1];
RightViewController *rightViewController = (RightViewController *)[rightNavController topViewController];
Player *selectedPlayer = [[leftViewController players]objectAtIndex:0];
[rightViewController setPlayer:selectedPlayer];
leftViewController.delegate = rightViewController;
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end