1

我决定添加UIContextMenuInteraction到我的UITableViewCell,它工作正常,但有 9+ 个字母(无图像)或 6+ 个字母(有图像)的标题正在缩短,如下所示:

在此处输入图像描述

委托方法的实现:

extension MyCustomCell: UIContextMenuInteractionDelegate {

    @available(iOS 13.0, *)
    func contextMenuInteraction(_ interaction: UIContextMenuInteraction,
                                configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
        return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { _ -> UIMenu in
            let first = UIAction(title: "8Letters") { _ in
                print("8 letters")
            }
            let second = UIAction(title: "9Letters+") { _ in
                print("9 letters")
            }
            let third = UIAction(title: "Hello", image: UIImage(systemName: "square.and.arrow.up")) { _ in
                print("5 letters + image")
            }
            let fourth = UIAction(title: "Hello+", image: UIImage(systemName: "square.and.arrow.up")) { _ in
                print("6 letters + image")
            }
            return UIMenu(title: "", children: [first, second, third, fourth])
        }
    }

}
4

1 回答 1

0

检查添加到您的项目以自定义 UITableViewCell 的任何第三方框架是否破坏了 UI。在我的情况下,问题是由我添加的第三方框架(“SkeletonView”)引起的,以便为 UITableViewCell 提供微光效果

于 2019-12-29T08:43:37.667 回答