OGeek|极客世界-中国程序员成长平台

标题: ios - 如何在 iOS 的 UITableViewCell 右侧放置另一个 TextLabel [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 02:54
标题: ios - 如何在 iOS 的 UITableViewCell 右侧放置另一个 TextLabel

我想在 iOS 中的 UITableViewCell 右侧放置另一个单元格文本,如下图所示。

enter image description here

我该怎么做?

感谢您的帮助。



Best Answer-推荐答案


UITableViewCell 有一个属性,detailTextLabel,它对应于你要查询的文本标签。只需将文本分配给该标签

  cell.textLabel.text = @"Google";
  cell.detailTextLabel.text= @"Yesterday";

小“箭头”是单元格上的附加 View

  cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

关于ios - 如何在 iOS 的 UITableViewCell 右侧放置另一个 TextLabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17218055/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4