アプリに分割ビューを実装しました。アプリを起動すると、正常に表示されます。
masterview=左側のビュー & detailView = ホーム ビュー
しかし、私のマスター ビューには 2 つのテーブル ビューも含まれています。テーブルビューの任意の行をクリックすると、詳細ビュー(現在、クラスビュー)が表示されません。
つまり、選択したマスタービューのテーブル行ごとに複数の詳細ビューを表示したいということです。
分割ビューの私のコードは次のとおりです。
// AppDelegate.h
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
LeftViewController *masterViewController = [[LeftViewController alloc] initWithNibName:@"LeftViewController_iPad" bundle:nil] ;
UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController] ;
HomeViewController *detailViewController = [[HomeViewController alloc] initWithNibName:@"HomeViewController_iPad" bundle:nil];
UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
masterViewController.home_Detail = detailViewController;
self.splitViewController = [[UISplitViewController alloc] init] ;
self.splitViewController.delegate = detailViewController;
self.splitViewController.viewControllers=[NSArray arrayWithObjects:masterNavigationController,detailNavigationController, nil];
self.window.rootViewController = self.splitViewController;
[self.window makeKeyAndVisible];
}
//LeftView.m
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.appDelegate.splitViewController viewWillDisappear:YES];
NSMutableArray *viewControllerArray=[[NSMutableArray alloc] initWithArray:[[self.appDelegate.splitViewController.viewControllers objectAtIndex:1] viewControllers]];
[viewControllerArray removeAllObjects];
if (tableView==tbl_class)
{
self.class_VC=[[Class_Vice_ViewController alloc]initWithNibName:@"Class_Vice_ViewController" bundle:nil];
[[NSUserDefaults standardUserDefaults]setInteger:[[[classNames objectAtIndex:indexPath.row]valueForKey:@"class_id"]intValue] forKey:@"psel_class"];
NSLog(@"%d",[[[classNames objectAtIndex:indexPath.row]valueForKey:@"class_id"]intValue]);
[viewControllerArray addObject:self.class_VC];
self.appDelegate.splitViewController.delegate = self.class_VC;
[[self.appDelegate.splitViewController.viewControllers objectAtIndex:1] setViewControllers:viewControllerArray animated:NO];
[class_VC viewWillAppear:YES];
}
}
この問題の解決を手伝ってください