0
votes

Thanks ahead of time. I am currently developing the iPad version of an app which on the iphone has 3 tabs,which each load 3 different rss feeds and then drill down to details with a navigation controller on the iPhone. On the iPad what makes sense is that I join 2 of the feeds in the first splitview, and then have a separate master and detail for the 3rd feed.

what is the best practice to accomplish this. I currently have setup a toolbar button in the first detailview, which calls the appdelegate which switches the master and detail as so

- (void)switchViews {

    VideoSelectorViewController *masterViewController = nil;
    VideoDetailiPadViewController *detailViewController = nil;
    UIViewController *tempDetail = [self.splitViewController.viewControllers objectAtIndex:1];
    UIViewController *tempMaster = [self.splitViewController.viewControllers objectAtIndex:0];
    [tempDetail.view removeFromSuperview];
    [tempMaster.view removeFromSuperview];
    [tempDetail release];
    [tempMaster release];
    tempDetail = nil;
    tempMaster = nil;

  //  if (row == 1) {
        VideoSelectorViewController *newMasterViewController = [[VideoSelectorViewController alloc] initWithNibName:@"VideoSelectorViewController" bundle:nil];
        masterViewController = newMasterViewController;

        VideoDetailiPadViewController *newDetailViewController = [[VideoDetailiPadViewController alloc] initWithNibName:@"VideoDetailiPadViewController" bundle:nil];
        detailViewController = newDetailViewController;

  //  }

    // Update the split view controller's view controllers array.
    NSArray *viewControllers = [[NSArray alloc] initWithObjects:masterViewController, detailViewController, nil];
    self.splitViewController.viewControllers = viewControllers;
    [viewControllers release];

/*  // Dismiss the popover if it's present.
    if (popoverController != nil) {
        [popoverController dismissPopoverAnimated:YES];
    }*/

    // Configure the new view controller's popover button (after the view has been displayed and its toolbar/navigation bar has been created).
   // if (detailViewController.popover != nil) {
        [detailViewController showRootPopoverButtonItem:detailViewController.rootPopoverButtonItem];
    //}

    [masterViewController release];
    [detailViewController release];


}

this works ok when the iPad is in landscape but on portrait the barbutton does not show up in the toolbar, how can i call - (void)splitViewController: (UISplitViewController*)svc willHideViewController programmatically? Also memory management for my method, should i release and set to nil the previous master and detail as I am with those temp objects in my switchViews method?

The other method is to push the new master on to the old, and just replace the detail. which is better, memory wise, performance, etc. thanks again

2

2 Answers

0
votes

Since nobody was able to give any insight, what I did was create a second view in the detailview which is only used with my second tableview