如何更改iPad的Master-Detail应用程序中的detailView

时间:2012-03-06 15:01:44

标签: xcode ipad master-detail

我为iPad制作了一个简单的Master-Detail应用程序,我在MasterViewController.m中有一个UITableView

现在,当我使用didSelectRowAtIndexPath时,如何使用DettaglioView.m(和nib)更改DetailView?

我从Xcode模板开始,但它将MasterViewController.m中的视图推送到您的NavigationController中。好吧,我需要选择单元格并更改detailView

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

    //è la classe che usa per visualizzare il dettaglio
    //UIViewController <SubstitutableDetailViewController> *detailViewController = nil;


    if (!self.detailViewController) {
        self.detailViewController = [[[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil] autorelease];
    }

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


    //[self.navigationController pushViewController:self.detailViewController animated:YES];
}

如何拦截DetailView以使用我的DettaglioView进行更改?

2 个答案:

答案 0 :(得分:0)

您想要更换细节中的任何内容吗?这就是你问的问题吗?你能直接[self.navigationController popToRootViewController:detailViewController animated:NO]?

答案 1 :(得分:0)

如果您希望另一个ViewController代替表格,请尝试:

//shows lvc in master
yourNewViewController *yvc = [[yourNewViewController alloc] initWithNibName:@"LyourNewViewControllerNibNameHere" bundle:nil];
[[self navigationController] pushViewController:yvc animated:YES];