1

虽然设置了单元格的字幕样式,但是detailTextLabel 仍然没有显示出来。

let cellIdentifier = "homeFeedItem"
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier) ?? UITableViewCell(style: .subtitle,     reuseIdentifier: cellIdentifier)
cell.textLabel?.text = self.arrItems[indexPath.row]["title"]
cell.detailTextLabel?.text = self.arrItems[indexPath.row]["desc"]
cell.imageView?.image = UIImage(named: self.arrItems[indexPath.row]["icon"]!)

我尝试打印 self.arrItems[indexPath.row]["desc"]。没关系。请帮我修复它。

4

1 回答 1

0

好,我知道了。最初由Scott Berrevoets回答

根据这个SO post,注册 UITableViewCell 意味着所有单元格都将使用默认样式进行实例化。registerClass:forCellReuseIdentifier: 不提供字幕和左右细节单元格。

于 2016-11-03T06:16:03.730 回答