ios - ios 13 UIContextMenu 显示缩短的 UIAction 标题
问题描述
我决定添加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])
}
}
}
解决方案
检查添加到您的项目以自定义 UITableViewCell 的任何第三方框架是否破坏了 UI。在我的情况下,问题是由我添加的第三方框架(“SkeletonView”)引起的,以便为 UITableViewCell 提供微光效果
推荐阅读
- r - 根据另一个(日期)变量的首次出现创建一个二进制变量
- php - get new line space in output log, but no echo command in php script
- android - Android RTL support for shapes corners radius
- css - Are there any browsers that do not have Arial available?
- dhall - 在 Dhall 的多行字符串中转义字符串插值
- java - Can't Start Minecraft with Command Line
- ios - iOS 13 UIPanGestureRecognizer behave differently from iOS 12
- android - Unresolved reference "Searcher"
- java - 当我尝试使用 BufferedReader 跳过多行时,为什么会收到 StringIndexOutOfBoundsException?
- rust - 如何编写一个盒装闭包来改变对结构的引用?