我正在尝试删除我的UITargetPreview. 我使背景颜色清晰,但是,您仍然可以看到背景的框架。
这是它目前的样子:
我目前有一个视图,其中包含文本容器和图像,这就是我用作UITargetedPreview.
有没有办法只显示图像和文本而不显示背景框架?
我想在文本上方添加像 iMessage 这样的反应,如下所示:
目前,我只能显示菜单,并且不确定如何在上面添加自定义视图。这就是我的样子:
如何添加与 iMessage 反应视图类似的视图?
这就是我在集合视图中创建上下文菜单的方法:
override func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
let post = isFiltering ? filteredPosts[indexPath.section] : posts[indexPath.section]
let identifier = NSString(string: "\(post.createdAt)")
if post.username == "" {return nil}
return UIContextMenuConfiguration(identifier: identifier, previewProvider: nil) { _ -> UIMenu? in
let deleteAction = UIAction(title: "Delete", image: UIImage(systemName: "trash")) { _ in
Service.deletePost(post: post)
}
let replyAction = UIAction(title: "Reply", image: UIImage(systemName: "arrowshape.turn.up.left")) { _ in
self.setReplyingView(post: post)
}
let noteTagAction …Run Code Online (Sandbox Code Playgroud)