如何向DetailDisclosureButton添加标签文本?
我在iOS Swift 2.0应用程序中工作。 我无法弄清楚如何在披露指标V形之前在UITableViewCell
的右侧设置文本(除了创建自定义的cell.accessoryView
)。
这是“设置应用程序”的屏幕截图,正是我正在努力实现的目标。
在Interface Builder中,设置单元格时,选择右侧详细信息样式:
然后将值detailTextLabel
属性:
cell.detailTextLabel.text = "Kilroy Was Here"
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "CellId") ?? UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: "CellId") cell.accessoryType = UITableViewCellAccessoryType.disclosureIndicator cell.textLabel?.text = "Main text" cell.detailTextLabel?.text = "Detail Text" return cell }