第一种解决办法:
要是使用这样注册cell
[_table registerNib:[UINib nibWithNibName:@"MiYunMyFocousCell" bundle:nil] forCellReuseIdentifier:@"MiYunMyFocousCell"];
You need to register the cells on the UISearchDisplayController's UITableView. The best way to do that is to register the cells when that table view is loaded.
下面的方法必须实现
- (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView
{
[tableView registerNib:[UINib nibWithNibName:@"MyCellNib" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"MyCellIdentifier"];
}
第二解决办法:
这样写 (可能会造成内存泄露)
MiYunMyFocousCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MiYunMyFocousCell"];
if (cell == nil) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"MiYunMyFocousCell" owner:self options:nil] firstObject];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}