草庐IT

UIImagepickercontroller

全部标签

ios - 从应用程序 ios swift 中删除使用 UIImagePickerController 拍摄的所有本地镜像和视频

我正在使用UIImagePickerController为应用程序拍摄图像和视频。我需要确保该应用程序占用最少的存储空间。因此,一旦我拍摄了图像/视频,我就会将其上传到我的服务器,以便我现在可以使用URL访问它。因此我需要的是每当应用程序终止时,我想清除所有拍摄的图像和视频,以确保消耗更少的内存。请注意,我不想在上传后立即删除文件。我知道如何从目录中单独删除文件。如果我错了,请提出其他方法。 最佳答案 不能保证applicationWillTerminate会被调用,可能这就是你不能这样做的原因(因此我需要的是每当应用程序终止时,我

ios - 选择视频时 iOS 10.3 中的 UIImagePickerController 崩溃

所以我正在做我已经写了数百次的非常简单的图像选择器。为此,我写了这个非常简单的扩展:extensionUIImagePickerController{funcpresent(overcontroller:UIViewController,withsource:UIImagePickerControllerSourceType,mediaTypes:[String]?=nil){DispatchQueue.main.async{self.allowsEditing=trueself.sourceType=sourceifsource==.camera{self.cameraDevice=

ios - 导航回 UIImagePickerController 的相机 View 时卡住

在UIImagePickerController的委托(delegate)中当用相机拍摄图像时,另一个View被推送到导航堆栈上:funcimagePickerController(_picker:UIImagePickerController,didFinishPickingMediaWithInfoinfo:[String:Any]){picker.pushViewController(otherViewController,animated:true)}在otherViewController导航栏可见:overridefuncviewDidLoad(){super.viewDi

ios - 如何删除 UIImagePickerController 中的缩放 slider

我需要移除相机屏幕中的缩放slider。这是我的代码:importUIKitextensionUIImagePickerController{classfuncsourceCameraModePhoto(_delegate:UIImagePickerControllerDelegate&UINavigationControllerDelegate,overlayView:UIView)->UIImagePickerController{letpicker=UIImagePickerController()picker.sourceType=.camerapicker.cameraCap

iOS Swift 3 UIImagePickerController 崩溃

我将项目升级到Swift3,然后在线上发生崩溃(在项目中的各个点/viewControllers):present(picker,animated:true,completion:nil)在函数中:@IBActionfuncuserImage(_sender:AnyObject){print("buttonpressed")letpicker=UIImagePickerController()picker.delegate=selfpicker.allowsEditing=falsepicker.sourceType=.photoLibrarypresent(picker,animat

ios - 错误 : Cannot subscript a value of type '[String : Any]' with an index of type 'UIImagePickerController.InfoKey'

这个问题在这里已经有了答案:Cannotsubscriptavalueoftype'[String:Any]'withanindexoftype'UIImagePickerController.InfoKey'(8个答案)关闭3年前。我正在尝试通过CoreML重建用于图像检测的Apple测试应用程序,但出现错误:Cannotsubscriptavalueoftype'[String:Any]'withanindexoftype'UIImagePickerController.InfoKeyextensionImageClassificationViewController:UIImag

swift - 警告 : Attempt to present <UIImagePickerController: > on <. ..> 已经呈现(空)

我在这里寻求帮助!我在swift中有一个ActionController,我试图从创建的一个Action中呈现一个UIImagePickerController,但是当我运行它时,它向我显示了这个警告:尝试呈现在上,它已经呈现(null),并且它没有呈现任何东西。这是我的代码:letactionController=TweetbotActionController()actionController.addAction(Action("PhotoLibrary",style:.Default,handler:{actioninletpicker=UIImagePickerControl

ios - UIImagePickerController 抛出错误

我有以下代码来打开照片库或相机,但每当我运行代码时,我都会收到运行时错误:WhatsUp[28458:10570522]***Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'***-[__NSDictionaryMsetObject:forKey:]:objectcannotbenil(key:_UIImagePickerControllerMediaTypes)'***Firstthrowcallstack:这是我的代码://openthecameraself.imagePicker=U

ios - 如何在 Swift 中保存从 UIImagePickerController 中选取的图像?

我正在构建一个应用程序,让用户可以从其照片库中选择一张图片。我正在使用此代码来保存它。funcimagePickerController(picker:UIImagePickerController,didFinishPickingImageimage:UIImage,editingInfo:[String:AnyObject]?){imgPicker.dismissViewControllerAnimated(true,completion:nil)NSUserDefaults.standardUserDefaults().setValue(image,forKey:"bgImage

ios - 点击视频按钮时 UIImagePickerController 崩溃

以下代码在使用相机拍摄照片时效果很好,但在用户点击视频时应用会崩溃。letimagePicker=UIImagePickerController()imagePicker.modalPresentationStyle=.currentContextimagePicker.delegate=selfiflet_=UIImagePickerController.availableMediaTypes(for:.camera){imagePicker.mediaTypes=UIImagePickerController.availableMediaTypes(for:.camera)!ifU