cell.accessoryType不显示

iOS 码拜 8年前 (2016-09-19) 1370次浏览
自定义一个tableview cell的xib文件;
然后使用tableview 本来想在选中显示勾的,发现根本不显示
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
后来直接把这句 放这里面 还是不显示
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *cellIndetifier = @”SimpleTableCell”;
SimpleTableCell *cell = (SimpleTableCell *) [tableView dequeueReusableCellWithIdentifier:cellIndetifier];
if(cell== nil)
{
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@”SimpleTableCell” owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.nameLabel.text= [tableData objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
return cell;
}
求懂的 指导下 谢谢啦
解决方案

20

你能否使用了 Auto Layout? 先把 xib 中的 Auto Layout 关掉试试,假如发现没问题了,就能确定是约束的问题了

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明cell.accessoryType不显示
喜欢 (0)
[1034331897@qq.com]
分享 (0)