ios - 在表格 View 单元格中添加向下箭头

标签 ios uitableview cocoa-touch

我正在寻找一种方法来实现底部箭头,就像在 Apple 的 Activity 应用中一样。

Screenshots of iOS activity app showing downward-pointing chevron in cells

我找不到类似的电池配件类型。

    cell.accessoryType = UITableViewCell.AccessoryType.none
    cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
    cell.accessoryType = UITableViewCell.AccessoryType.detailDisclosureButton
    cell.accessoryType = UITableViewCell.AccessoryType.checkmark
    cell.accessoryType = UITableViewCell.AccessoryType.detailButton

我知道我可以在那里插入一个 UIImage 但也许有更好的解决方案来解决这个问题。我在其他单元格中使用默认披露指示符,因此我想在我的应用程序中保留相同的设计。

最佳答案

正确的解决方案是添加自定义图像 Assets 并将 UIImage 放置在单元格的 accessoryView 中。

一个 hacky 解决方案 - 这可能行不通 - 你可以尝试将 accessoryType 设置为 disclosureIndicator 然后尝试旋转 accessoryView 通过将其 transform 设置为 CGAffineTransform(rotationAngle: .pi/2)

关于ios - 在表格 View 单元格中添加向下箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55188130/

相关文章:

ios - 如何跨 View 层次定位布局?

ios - 如何获取自定义单元格并通过索引路径使用它的自定义项 - swift3?

ios - 如何在同一类中为不同的选择器使用 viewForRow 和 titleForRow?

ios - SFSafariViewController 中 'Done' 的默认行为是什么?

ios - 没有这样的模块 'Koloda"

ios - 如何使用 Swift 获取 Xcode 根文件夹目录路径

ios - 在 Swift 中将 CLLocation 转换为 MKMapItem

ios - 在 UITableView 的单元格中下载图像的最佳实践?苹果/swift

iphone - 自动检查 iOS < 4.0 不支持的 API 调用?

iphone - 异步下载图片