从SearchDisplayController推送到新视图

时间:2013-04-23 10:52:18

标签: iphone ios objective-c xcode

尝试从搜索结果推送到新视图,并且出于某种原因未调用代码。对不起,我不能更具描述性。

以下是代码:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self.table deselectRowAtIndexPath:indexPath animated:YES];
int selectedTemplateID = [((CollectionItem*)[cllct objectAtIndex:indexPath.row]).tID intValue];

ACollection *newView = [[ACollection alloc] initWithID:selectedTemplateID];
newView.template = [cllct objectAtIndex:indexPath.row];

if(tableView == self.table) {
    [self.navigationController pushViewController:newView animated:YES];
    newView.theTitle = [self.table cellForRowAtIndexPath:indexPath].textLabel.text;
}
if(tableView == self.searchDisplayController.searchResultsTableView) {
    NSLog(@"Should push");
    [self.navigationController pushViewController:newView animated:YES];
    newView.theTitle = [self.table cellForRowAtIndexPath:indexPath].textLabel.text;
  }

}

由于

1 个答案:

答案 0 :(得分:-1)

首先检查tableview的数据源和委托。 删除[self.table deselectRowAtIndexPath:indexPath animated:YES];并检查一次。