Tag: uisearchresultscontroller

如何在故事板中使用search结果控制器使用原型单元格

我有search结果控制器时,在search栏search得到这个错误表明,没有细胞,并得到以下错误。如何可以在此方法中创build我的prototype单元格CellForRowAtIndexPath 代码: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"HoCell"; Ho *cell; Ho *item; if (tableView == self.searchDisplayController.searchResultsTableView) { if (cell == nil) { cell = [[Ho alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"HoCell"]; } item = [searchResultsController objectAtIndexPath:indexPath]; } else{ cell = (Ho*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; item = [fetchedResultsController objectAtIndexPath:indexPath]; } cell.ho.text = item.name; cell.selectedBackgroundView = […]

UISearchDisplayController的searchResultsTableView的ContentSize不正确。 在iOS 7中的错误?

下面的问题只发生在iOS 7.0以上版本的iOS 6.0 / 6.1应用程序上。 所以我有一个UISearchDisplayController ,它search我们的API并返回数据。 这一切正常,一切都按照我们的要求显示。 我们看到的唯一的问题是,在内容填充了searchResultsTableView ,似乎好像键盘最初隐藏时, searchResultsTableView的contentSize比数据大得多,而实际上似乎是键盘的大小。 当我进入search栏,并显示键盘,再次点击“search”(只是隐藏键盘), contentSize然后正确调整,只填满屏幕,没有更多。 下面是我正在讨论的最初的tableView人口的屏幕截图。 白色是表格数据,灰色/奶油色是额外的tableView空间。 有想法该怎么解决这个吗?