在Swift中,可以使用UIImagePickerController来从相册中选择多个视频。以下是实现该功能的步骤:
import UIKit
class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
// ...
}
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .photoLibrary
imagePicker.allowsMultipleSelection = true
imagePicker.delegate = self
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let selectedVideos = info[.mediaURL] as? [URL] {
// 处理选择的视频
}
picker.dismiss(animated: true, completion: nil)
}
present(imagePicker, animated: true, completion: nil)
通过以上步骤,你可以在Swift中实现从相册中选择多个视频的功能。
腾讯云相关产品推荐:
请注意,以上推荐的腾讯云产品仅供参考,具体选择应根据实际需求进行。
领取专属 10元无门槛券
手把手带您无忧上云