ios - 当 tableview 处于编辑模式时,如何在 swift 3+ 中设置行顶部的重新排序控件

标签 ios swift tableview

当 tableview 处于编辑模式时,我想更改并设置 tableviewcell 中行顶部的重新排序控制图标。

最佳答案

经过长时间的尝试和点击,我找到了以下解决方案。

用于在cell.subviews中查看{ if String(描述: view.description).range(of:"Reorder") != nil {

                for subview in view.subviews {
                    if subview.isKind(of: UIImageView.self)  {

                        let subImgV = subview as! UIImageView
                        if subImgV.image != UIImage(named: "rearrangeIcon") {
                            subImgV.image = UIImage(named: "rearrangeIcon")
                            subview.frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height); // First we need to increse its size as it is superview after that set imageView content mode left, right, top, bottom
                            subImgV.contentMode = .top

                        }
                    }
                }
            }
        }

关于ios - 当 tableview 处于编辑模式时,如何在 swift 3+ 中设置行顶部的重新排序控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48821871/

相关文章:

ios - 在 Swift 中显示 GoogleMaps View ?

ios - 如何将 CIImage 保存到 Photos 并保持其 P3 色彩空间完好无损?

ios - 每 5 个应用程序打开显示全屏广告

iOS 应用传输安全

java - FXML TableView "Class fxmlPerson does not support property "bestellnr"

ios - 使用动画更改 UIScrollView contentSize

ios - 如何在 Swift 3 中的图像上添加不透明的黑色

ios - swift2 当应用程序在后台时如何记录?

ios - 当与添加到 subview 的 UITableView 一起使用时,prefersLargeTitles 无法按预期工作

iphone - 从用作 tableHeaderView 的 xib 文件内的按钮转到 VC