试图从搜索结果推送到新视图,但由于某种原因,代码没有被调用。抱歉,我不能再描述了。
代码如下:
-(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;
}
}谢谢
发布于 2013-04-23 19:05:28
首先检查tableview的数据源和代理。卸下[self.table deselectRowAtIndexPath:indexPath animated:YES];并检查一次。
https://stackoverflow.com/questions/16167488
复制相似问题