我正在使用情节提要和自定义单元格。我正在尝试搜索。它工作正常,并在加载 tableviewcontroller 时加载自定义单元格,一旦我输入搜索字符,返回的单元格是 UITableViewCellStyleDefault 并且我只能设置标签,我不确定它为什么不选择自定义单元格。有人可以帮忙吗。
抱歉,这是重复的,但我不知道它是如何工作的。
我正在使用此代码。
static NSString *CellIdentifier = @"memberCell";
MemberCell *cell = (MemberCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSDictionary *item = self.searchList[indexPath.row];
if (cell == nil) {
cell = [[MemberCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.memberFullName.text = [item[@"full_name"] uppercaseString] ;
cell.memberPosition.text = [item[@"title"] length] < 1 ? [NSString stringWithFormat:@"%@", item[@"districts"]] : [NSString stringWithFormat:@"%@, %@", item[@"title"], item[@"districts"]];
cell.memberRoom.text = [NSString stringWithFormat:@"Rm %@", item[@"room_number"] ];
[cell.memberImage setImageWithURL:[NSURL URLWithString:item[@"image_thumb"]]
placeholderImage:[UIImage imageNamed:@"placeholder"]];
迪帕克