views:

200

answers:

1

How can I change the view in the Details pane of the UISplitView so that its a completely different view?

Im having a fair amount of trouble understanding how its all wired up and where things should go at the moment, could someone please enlighten me?

What I would love to be able to do is to show a specific view based on what the user has selected in the UITableView on the left pane (this view could be an image, or a more complex view of a news article, etc... many different options) then when the user turns the iPad into portrait view, that view that was in the details pane changes to be its equivalent portrait view version.

Does this make sense?

How on earth would I do that?

Just to brainstorm, here is what I was thinking:

  • Create a Split View project

Create 2 NIBs for each view: (with accompanying view controllers???)

  • PortraitNewsStory
  • LandscapeNewsStory
  • PortraitImageBrowser
  • LandscapeImageBrowser
  • etc...

  • Create a UISplitView control using XCode

  • Capture when a user rotates the iPad (should this be done in the RootViewController.m ?)

  • Change the view of the DetailViewController how should I do this?

  • profit???

Thanks Mark

A: 

Change the view of the DetailViewController how should I do this?

In Simple, you can make another UIViewController (ex named as MyCostomViewController) with corresponding nib file. Then do the following inside the method under rootViewController

- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    /*
     When a row is selected, set the detail view controller's detail item to the item associated with the selected row.
     */
    //detailViewController.detailItem = [NSString stringWithFormat:@"Row %d", indexPath.row];
    MyCostomViewController *cus = [[MyCostomViewController alloc] initWithNibName:@"MyCostomViewController" bundle:nil];
    [detailViewController.view addSubview:cus.view];

}
chatcja