
但是,当故事板混合中引入UISearchbardisplayController时,不是太复杂,如何将结果单元格转换为detailVIEwController?
我能够毫无问题地进行搜索,我遵循了本教程:http://clingingtoideas.blogspot.com/2010/02/uitableview-how-to-part-2-search.html
我所能做的就是从搜索中选择一行,它变为蓝色,不会转到detailVIEwController.
我已经实现了prepareForSegue方法,该方法适用于未搜索的单元格,但无法弄清楚这一点.
解决方法 这是基于@James Chen评论的解决方案.还使用不同的IndexPath,具体取决于表所处的状态.- (voID)prepareForSegue:(UIStoryboardSegue *)segue sender:(ID)sender{ if ([[segue IDentifIEr] isEqualToString:@"toDetail"]) { Person *person = nil; if (self.searchdisplayController.active == YES) { NSIndexPath *indexPath = indexPath = [self.searchdisplayController.searchResultstableVIEw indexPathForSelectedRow]; NSLog(@"segue - section: %d,row: %d",indexPath.section,indexPath.row); person = [self.filteredPersonArray objectAtIndex:indexPath.row]; } else { NSIndexPath *indexPath = indexPath = [self.tableVIEw indexPathForSelectedRow]; NSLog(@"segue - section: %d,indexPath.row); person = [self.personArray objectAtIndex:indexPath.row]; } [[segue destinationVIEwController] setPerson:person]; }} 总结 以上是内存溢出为你收集整理的ios – 如何从UISearchBarDisplayController结果转换为detailViewController全部内容,希望文章能够帮你解决ios – 如何从UISearchBarDisplayController结果转换为detailViewController所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)