iOS 13 UIContextMenu显示缩短的UIAction标题

时间:2019-12-05 13:26:33

标签: ios swift ios13 ios13.2 uicontextmenuinteraction

我决定将UIContextMenuInteraction添加到我的UITableViewCell中,效果很好,但是具有9个以上字母(没有图像)或6个以上字母(带有图像)的标题会像这样缩短:

enter image description here

委托方法的实现

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])
        }
    }

}

1 个答案:

答案 0 :(得分:0)

检查添加到您的项目中以用于自定义UITableViewCell的任何第三方框架是否破坏了UI。就我而言,该问题是由我添加的第三方框架(“ SkeletonView”)引起的,该框架使UITableViewCell具有微光效果