iphone - 从 UISearchDisplayController 推送到新 View

标签 iphone ios objective-c xcode

尝试从搜索结果推送到新 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/

相关文章:

objective-c - NSPopover 颜色

ios - 可以通过 iOS 中的蓝牙 PAN 与系留设备进行通信

objective-c - awakeFromNib 之后 NSWindow 为零

ios - 如何将其他NSManagedObjects存储为NSManagedObject的属性

iphone - iOS 中的委托(delegate)

ios - 单击时如何去除半透明按钮上的灰色层

ios - 无法在 Swift 4 中将 UILabel 添加到 UIView

iphone - 发布数据格式与我需要的不同

ios - 没有 EXC_BAD_ACCESS 不能使 viewController 透明

iphone - 在ios中使用自定义键盘的问题