For my ipad application i have requirement like this

For each row in root view, i want to display different detail view and

Detail view has some buttons click on it will show another view ( detailview needs to be under navigation controller)

Anyone can give me tutorial/example code/video which meets this requirement?

I have tried more than 20 similar questions here and search youtube and all but no luck.

I got one link http://kshitizghimire.com.np/uisplitviewcontroller-multipledetailviews-with-navigation-controller/ but it has some problem with pop-over is not being hidden when we select a row in portrait mode.

Any help would be appreciated.

Thanks.

PS: My requirement is something like this

ROOTVIEW
|— OPTION 1
|— (uinavigationcontroller)
| |OPT1_DETAILVIEW
| |– OPT1_DRILLDOWNVIEW1
| |–OPT1_DRILLDOWNVIEW2
| |–etc
|— OPTION 2
|— (uinavigationcontroller)
| |OPT2_DETAILVIEW
| |– OPT2_DRILLDOWNVIEW1
| |–etc
|— OPTION 3, etc
有帮助吗?

解决方案

I also faced this problem for my project. I accomplished this using following code

What you have to do is when you tap on any cell of root view controller's tableview you have to load the appropriate viewcontroller.

The following code you have to write in tableViewDidSelectRowaAtIndexPath section of root view controller's tableview.

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

    //Load previous controllers array.

    NSMutableArray *viewControllerArray=[[NSMutableArray alloc] initWithArray:splitViewController.viewControllers]; 

    //Remove last Detail View controller Object.

    [viewControllerArray removeLastObject];

    // Check appropirate row value.

    if (indexPath.row == 0) {
        // Add new Detail controller in your array ...
        FirstViewController *fvc=[[[FirstViewController alloc] initWithNibName:@"FirstViewController"  bundle:nil] autorelease];        
        [viewControllerArray addObject:fvc];
    }
    else if (indexPath.row == 1) {
        // Add new Detail controller in your array ...
        SecondViewController *svc=[[[SecondViewController alloc] initWithNibName:@"SecondViewController"  bundle:nil] autorelease];        
        [viewControllerArray addObject:svc];
    }
    // And so on..

    // Set New View Controllers of SplitViewController

    [splitViewController setViewControllers:viewControllerArray];   
    [viewControllerArray release];      
}

I did that and it worked. I hope it may help.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top