ios - 在 Swift 4 中为 Webview 调整图像大小
问题描述
我有一个用 Swift 4 编写的非常简单的 iPhone 应用程序,它基本上只是加载一个 WebView 全屏。所有重要的事情都通过 HTTP 发生并且工作正常。我的网页的一部分允许用户上传照片。经过大约 3 个月的尝试找出为什么在最新的 iOS 上退出工作后,我终于能够修复它。但现在我想在上传图片之前调整它们的大小。我不知道在哪里添加代码来做到这一点,因为我的照片似乎从来没有通过代码。ImagePicker 加载时只运行一次,然后我不知道如何获取照片本身。希望你能帮忙!这是我选择 HTTP 链接以选择图像时运行的内容。
override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) {
imagePicker.dismiss(animated: true, completion: nil)
if viewControllerToPresent is UIImagePickerController {
viewControllerToPresent.modalPresentationStyle = .overFullScreen
}
super.present(viewControllerToPresent, animated: flag, completion: completion)
}
在选择器中选择图像后,它应该调整它们的大小并上传较小的照片。
解决方案
推荐阅读
- file - 组件移动文件导致 java.io.IOException,并试图移动到错误的文件夹
- java - 如何使用 ant updatesystem 在 hybris 中包含补丁?
- android - 检查 ViewPager ellipsize 上的 Textview 是否
- git - 如何将所有文件添加到文件中给出文件路径的阶段
- r - r - 获取用户输入并使用“for 循环”进行分配
- awk - grep 多个图案和打印图案及其前几行
- html - 屏幕阅读器能正常阅读 HTML Spas 吗?
- r - 循环绘制数据框
- android - 如何在使用 setSpan 时忽略某些单词或字符
- python - 无法在python中停止计时器(after和after_cancel)