swift - 将图像添加到操作表
问题描述
如何将表格视图的屏幕截图添加到 UIAlertController 中的第一个“动作”?我试着那样做
let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let action = UIAlertAction(title: NSLocalizedString("Share routine", comment: ""), style: .default, handler: { _ in
})
action.setValue(image, forKey: "image")
actionSheet.addAction(action)
actionSheet.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil))
UIApplication.topViewController()?.present(actionSheet, animated: true, completion: nil)
解决方案
我试过你的代码,发现了一些错误
首先,代替图像使用
image.withRenderingMode(.alwaysOrigin)
如果您想将图像放置到某个位置,请使用 imageView
推荐阅读
- c# - scanner become slow after i AdjustScannerSettings
- css - 'outlined' not working in Material UI Select
- c - 如何获得这个 C 程序的输出?
- google-apps-script - onEdit(e) executes too quickly before it can finish
- c++ - When I try to declare a function inside of a function it doesn't work? Any suggestions? *source code below*
- c++ - What size should be aimed for when breaking up large data structures for processing? Specifically segment size of sieve
- flutter - 飞镖构造函数中的括号是什么
- python - 如何减少 cx_Freeze 编译的 Python 可执行文件大小?
- node.js - nodejs cant connect to mongodb using mongoose
- python - 从句子列中提取新特征 - Python