简体   繁体   English

搜索栏和显示控制器-tableView问题

[英]search bar and display controller - tableView problems

I am trying to add a search bar and display controller into my iOS project using storyboards. 我正在尝试使用情节提要板将搜索栏和显示控制器添加到我的iOS项目中。

The tutorials I have followed are on 'Appcoda' and 'Ray Wenderlich'. 我遵循的教程是关于“ Appcoda”和“ Ray Wenderlich”的。 However, in my project I have custom UITableViewCells that expand their height when a small arrow at the bottom of the cell is pressed (using heightForRowAtIndexPath ). 但是,在我的项目中,我具有自定义UITableViewCells ,当按下单元格底部的小箭头时(使用heightForRowAtIndexPath ),它们可以扩展其高度。 But when I type in the search bar, I am aware that the same tableview (the original one with the custom cells and heights) is used to populate the search display controller's tableView . 但是,当我在搜索栏中键入内容时,我知道相同的tableview (具有自定义单元格和高度的原始tableview )用于填充搜索显示控制器的tableView

How to use a basic tableView for search results instead, with just a title, image and subtitle on each cell, as apposed to my custom one? 如何使用基本tableView代替搜索结果,每个单元格上只有标题,图像和字幕,这与我的自定义视图相对应?

If you only has one tableview and that tableview is being reloaded after your search, then obviously the same tableview will be used. 如果只有一个表视图,并且在搜索后将重新加载该表视图,则显然将使用相同的表视图。

What you need (if I understand your question correctly) is to have 2 custom cell. 您需要的(如果我正确理解了您的问题)是拥有2个自定义单元。 You can identify them via different cellidentifier on storyboard. 您可以通过情节提要上的其他cellidentifier识别它们。 And use them based on different occasions. 并根据不同场合使用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM