change DetailViewController on fly? #54

Open
Stan92 opened this Issue Jan 26, 2012 · 1 comment

2 participants

@Stan92

Hi,
this is not an issue... :)
but I can't figure out how to change the detailviewController.
From my masterview controller, I would like to change the detailViewController regarding the row pressed?
Any idea?

@johanneslagos

You can do like this:

[mgSplitViewController viewWillDissapear:YES]

NSMutableArray *rootArray = [[mgSplitViewController.viewControllers objectAtIndex:0]viewControllers];
NSMutableArray *detailArray = [[mgSplitViewController.viewControllers objectAtIndex:1]viewControllers];

UIViewController *yourRootView = [UIViewController alloc]initWithFrame:...];
[rootArray addObject:yourRootView];
[mgSplitViewController.viewControllers objectAtIndex:0]setViewControllers:rootArray animated:NO];

UIViewController *yourDetailView = [UIViewController alloc]init];
mgSplitViewController.delegate = yourDetailView;
[detailArray addObject:yourDetailView];
[mgSplitViewController.viewControllers objectAtIndex=0]setViewControllers:detailArray animated:NO];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment