我正在尝试为我的 TableView 显示副标题,但我一直收到一条错误消息,提示“分配给只读属性”我部署文本的代码是
cell.textLabel.text = [arrayData objectAtIndex:indexPath.row];
cell.detailTextLabel = [arraySubtitle objectAtIndex:indexPath.row];
return cell;
但是在第二行,我得到了错误!请帮我!谢谢! ( objective-c )
最佳答案
您正在尝试将值(可能是字符串)分配给 cell
的标签,而不是单元格标签的文本(属性)。
试试这个....
cell.textLabel.text = [arrayData objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [arraySubtitle objectAtIndex:indexPath.row]; // Update here,
return cell;
关于ios - 向 TableView 单元格添加副标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42463727/