首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从SearchDisplayController推送到新视图

从SearchDisplayController推送到新视图
EN

Stack Overflow用户
提问于 2013-04-23 18:52:18
回答 1查看 157关注 0票数 1

试图从搜索结果推送到新视图,但由于某种原因,代码没有被调用。抱歉,我不能再描述了。

代码如下:

代码语言:javascript
复制
-(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;
  }

}

谢谢

EN

回答 1

Stack Overflow用户

发布于 2013-04-23 19:05:28

首先检查tableview的数据源和代理。卸下[self.table deselectRowAtIndexPath:indexPath animated:YES];并检查一次。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16167488

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档