gpt4 book ai didi

iphone - 从 UISearchDisplayController 推送到新 View

转载 作者:行者123 更新时间:2023-11-28 17:54:43 26 4
gpt4 key购买 nike

尝试从搜索结果推送到新 View ,但由于某种原因代码未被调用。抱歉,我无法描述得更清楚。

代码如下:

-(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;
}

}

谢谢

最佳答案

首先检查tableview的datasource和delegat。删除 [self.table deselectRowAtIndexPath:indexPath animated:YES]; 并检查一次。

关于iphone - 从 UISearchDisplayController 推送到新 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16167488/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com