【问题标题】:how can I change the button of a detailDisclosureButton of a UITableViewCell如何更改 UITableViewCell 的 detailDisclosureButton 的按钮
【发布时间】:2017-01-20 22:56:30
【问题描述】:

我正在尝试更改 UITableViewCell 的 detailDisclosureButton 的默认按钮。

我可以通过执行以下操作来更改按钮:

button.frame = CGRect(x: 0, y: 0, width: 10, height: 10)
button.backgroundColor = UIColor.black
cell.accessoryView = button

但是,在这种情况下,我丢失了详细信息按钮右侧的披露指示克拉。那是因为根据文档定义一个accessoryView会忽略accessoryType的值。

无论如何要让附件类型为 detailDisclosureButton 并为按钮定义自定义图像。即自定义按钮并保留克拉以供披露?

【问题讨论】:

    标签: ios swift xcode tableviewcell


    【解决方案1】:

    也许这就是你想要的:link to apple docs

    它很旧,但它向您展示了一个仅具有定制的配件或配件的示例。

    这利用子类化 UIControl 并覆盖子类中的 drawRect

    感谢这里的答案:https://stackoverflow.com/a/27938584/1619193

    问题不完全是重复的,我不想发布仅链接的解决方案

    希望这就是你要找的东西

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-29
      • 1970-01-01
      • 1970-01-01
      • 2018-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多