我决定将UIContextMenuInteraction添加到我的UITableViewCell中,它工作得很好,但是有9+字母(没有图像)或6+字母(有图像)的标题被缩写成这样:

delegate方法的实现:
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])
}
}
}发布于 2019-12-29 16:43:38
检查添加到项目中用于自定义UITableViewCell的任何第三方框架是否破坏了UI。在我的例子中,这个问题是由第三方框架( "SkeletonView")引起的,我添加这个框架是为了给UITableViewCell带来闪光效果
https://stackoverflow.com/questions/59196230
复制相似问题