iOS拆分视图 - 重新加载详细信息视图

时间:2011-08-27 14:31:57

标签: objective-c ios ipad

我是制作iOS应用的新手。我目前已经构建了基于Split View的应用程序。左边有一个数组有一个表,触摸它会在详细视图中加载相关的xib文件。

现在我想要一个主页按钮。我希望这基本上重新加载DetailViewController来刮擦。到目前为止,我已经让它像这样工作了:

- (IBAction)homeButtonPressed:(id)sender;
{


    [[NSBundle mainBundle] loadNibNamed:@"DetailView" owner:self options:nil];//load xib
    self.navigationItem.rightBarButtonItem = nil;//hide the home button
    [self setTitle:@"Driveway Code"];//display the title
}

但问题是它仍然在左侧选择了行。我似乎无法选择它。

如果您可以帮我重新加载拆分视图或只是取消选择该行。我会很高兴。谢谢:))

更新:

我现在就去了:

- (IBAction)homeButtonPressed:(id)sender;
{



    [[NSBundle mainBundle] loadNibNamed:@"DetailView" owner:self options:nil];
    self.navigationItem.rightBarButtonItem = nil;

    [self setTitle:@"Driveway Code"];
    DetailViewController *dvc = [[DetailViewController alloc] init]; [dvc setTableView:tableView];

    [tableView deselectRowAtIndexPath:detailItem animated:YES];



}

1 个答案:

答案 0 :(得分:0)

使用此方法以编程方式选择行:

- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition

这个用于取消选择

- (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated
相关问题