iOS 叠加和动画无法打开我模拟器的相机照片
iOS overlay and animation is not opening my simulator's camera photos
我是 iOS 开发的新手,但我正在尝试按照 raywenderlich.com 教程向视频添加动画和叠加层,但我遇到了一些意外行为。出于某种原因,当我按下 pickButton 时,它会将我带到我的“记忆”而不是我的模拟器中的相机胶卷(见下图)。真正奇怪的是,当我 运行 代码时,调试器是完全空白的。根据调试器,似乎没有任何 运行ning,但当我在模拟器中查看时,应用程序本身似乎正在运行。有几个打印语句应该显示在调试器中,但我什么也没看到。您可以从上面的超链接下载整个代码库(它非常小)。我不确定为什么这不起作用。
@IBAction func pickVideoButtonTapped(_ sender: Any) {
pickVideo(from: .savedPhotosAlbum)
}
private func pickVideo(from sourceType: UIImagePickerController.SourceType) {
let pickerController = UIImagePickerController()
pickerController.sourceType = sourceType
pickerController.mediaTypes = [kUTTypeMovie as String]
pickerController.videoQuality = .typeIFrame1280x720
if sourceType == .camera {
pickerController.cameraDevice = .front
}
pickerController.delegate = self
present(pickerController, animated: true)
}
你在哪里调用这个函数private func pickVideo(from sourceType: UIImagePickerController.SourceType)
,你要交出什么UIImagePickerController.SourceType
?最好向我们展示调用该函数的代码。
On the other hand, working with the camera and importing images is always kind of difficult on the simulator, since it cannot access the camera and therefore has no images. Try to run the code and an actual device (Your iPhone). Maybe it is working on there.
尝试一下,如果不起作用,请提供调用 pickVideo
函数的代码。
我是 iOS 开发的新手,但我正在尝试按照 raywenderlich.com 教程向视频添加动画和叠加层,但我遇到了一些意外行为。出于某种原因,当我按下 pickButton 时,它会将我带到我的“记忆”而不是我的模拟器中的相机胶卷(见下图)。真正奇怪的是,当我 运行 代码时,调试器是完全空白的。根据调试器,似乎没有任何 运行ning,但当我在模拟器中查看时,应用程序本身似乎正在运行。有几个打印语句应该显示在调试器中,但我什么也没看到。您可以从上面的超链接下载整个代码库(它非常小)。我不确定为什么这不起作用。
@IBAction func pickVideoButtonTapped(_ sender: Any) {
pickVideo(from: .savedPhotosAlbum)
}
private func pickVideo(from sourceType: UIImagePickerController.SourceType) {
let pickerController = UIImagePickerController()
pickerController.sourceType = sourceType
pickerController.mediaTypes = [kUTTypeMovie as String]
pickerController.videoQuality = .typeIFrame1280x720
if sourceType == .camera {
pickerController.cameraDevice = .front
}
pickerController.delegate = self
present(pickerController, animated: true)
}
你在哪里调用这个函数private func pickVideo(from sourceType: UIImagePickerController.SourceType)
,你要交出什么UIImagePickerController.SourceType
?最好向我们展示调用该函数的代码。
On the other hand, working with the camera and importing images is always kind of difficult on the simulator, since it cannot access the camera and therefore has no images. Try to run the code and an actual device (Your iPhone). Maybe it is working on there.
尝试一下,如果不起作用,请提供调用 pickVideo
函数的代码。