cell.accessoryType不显示

来源:互联网 发布:淘宝国际转运 编辑:程序博客网 时间:2024/05/17 01:00
自定义一个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;
}
求懂的 指导下 谢谢啦
0 0
原创粉丝点击