Tag: uiimagepickercontroller

将选取的图像保存到CoreData

我能够从照片库中挑选并显示图像,但是我的目标是能够将所选图像或文件path保存到核心数据,以便在select保存的logging时也可以显示图像。 我有CoreData的工作,我能够显示来自CoreData的文本罚款,这只是图像抱着我。 @IBAction func addPic(sender: AnyObject) { pickerController.delegate = self pickerController.sourceType = UIImagePickerControllerSourceType.PhotoLibrary // 2 self.presentViewController(pickerController, animated: true, completion: nil) // Displays image func imagePickerController(picker: UIImagePickerController!,didFinishPickingMediaWithInfo info: NSDictionary!){ image.image = info[UIImagePickerControllerOriginalImage] as? UIImage self.dismissViewControllerAnimated(true, completion: nil)

使用UIImagePickerController时,iOS 10错误 <私人>

我正在使用XCode 8并使用iOS 10.2 Beta进行testing。 我已经添加了照片,PhotosUI和MobileCoreServices框架来投影。 非常简单的代码: #import <Photos/Photos.h> #import <PhotosUI/PhotosUI.h> #import <MobileCoreServices/MobileCoreServices.h> @interface ViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate, PHLivePhotoViewDelegate> @property (strong, nonatomic) IBOutlet UIImageView *imageview; @end 和执行: – (IBAction)grab:(UIButton *)sender{ UIImagePickerController *picker = [[UIImagePickerController alloc]init]; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker.allowsEditing = NO; picker.delegate = self; // make sure we include Live Photos (otherwise we'll only get […]

Swift PNG图像以不正确的方向保存

如果在保存之前使用图像,则是正常的。 但是,如果我保存并在以后使用它是90度转向。 我怎样才能确保它不会横向保存? func saveEvent(_ center1: CLLocation, title2: String, imagePicked1: UIImage) { let data = UIImagePNGRepresentation(imagePicked1);/// let url = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(NSUUID().uuidString+".dat") do { try data!.write(to: url!, options: []) } catch let e as NSError { print("Error! \(e)"); return } let image11 = CKAsset(fileURL: url!) self.eventRecord.setObject(image11 as CKAsset, forKey: "Picture") let publicData = CKContainer.default().publicCloudDatabase publicData.save(self.eventRecord, completionHandler: […]

UIImage在iPhone上用文件名保存图像

我怎样才能保存一个图像(如使用UIImageWriteToSavedPhotosAlbum()方法)与我select的文件名私人/ var文件夹?

在横向上使用UIImagePickerController

我正在创build一个横向模式的应用程序,我正在使用UIImagePickerController拍摄使用iPhone相机的照片,我也想在横向模式下创build它。 但是,正如苹果的文件显示, UIImagePickerController不支持横向,所以我应该怎么做才能获得所需的function?

UIImagePickerController不填充屏幕

截图http://i39.tinypic.com/oiermb.png 我向UIImagePickerController添加一个自定义覆盖,并在视图的底部有一个持久的黑色栏。 这是我的代码来实例化控制器。 – (UIImagePickerController *)imagePicker { if (_imagePicker) { return _imagePicker; } _imagePicker = [[UIImagePickerController alloc] init]; _imagePicker.delegate = self; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { _imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; _imagePicker.showsCameraControls = NO; _imagePicker.wantsFullScreenLayout = YES; _imagePicker.navigationBarHidden = YES; _imagePicker.toolbarHidden = YES; } else { _imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } return _imagePicker; } 返回的控制器是模式显示,并运行得很好(即显示全屏),当我不隐藏相机控制。 感谢Ole的build议,我使用了这个代码: // Resize the […]

自定义视图的相机

我的应用程序使用相机,我想添加覆盖在相机预览。 例如,我想在使用相机时使用相框,我也想为相机操作添加一个自定义栏。 请帮助我也这样做。

iOS 8 SDK:模态UIWebView和相机/图像select器

我发现,编译iOS 8(并在iOS 8中运行)时, UIWebView无法显示相机/图像select器,如果UIWebView在模态呈现的视图控制器中。 它可以在视图控制器中直接从窗口rootViewController或从其中推送的视图控制器中“挂起”,而没有问题。 testing应用程序可以在https://dl.dropboxusercontent.com/u/6214425/TestModalWebCamera.zipfind,但我会在下面描述。 我的testing应用程序(用故事板构build,但真正的应用程序不使用它们)有两个视图控制器(非原名称的ViewController和ViewController2 )。 ViewController包含在作为根视图控制器的UINavigationController中。 ViewController包含一个UIWebView (工作正常),一个“显示”(“推”)button和一个UIBarButtonItem ,它模态地呈现ViewController2 。 ViewController2有另一个UIWebView ,当“推”,而不是“呈现”时,工作。 ViewController和ViewController2都加载了: – (void)viewDidLoad { [super viewDidLoad]; [self.webView loadHTMLString:@"<input type=\"file\" accept=\"image/*;capture=camera\">" baseURL:nil]; } 当试图使用模式UIWebView Xcode在控制台中打印以下内容并解散应用程序模式: Warning: Attempt to present <UIImagePickerController: 0x150ab800> on <ViewController2: 0x14623580> whose view is not in the window hierarchy! 我目前的理论是, UIActionSheet到UIAlertController的变化可能产生了这种情况,但是很难certificate。 以防万一,我会打开雷达与苹果,以防万一。 有人发现相同的情况和一些解决方法?

在iOS中检测相机的权限

我开发了一个非常简单的video应用程序。 我使用官方控件:UIImagePickerController。 这是问题。 当第一次展示UIImagePickerController时,iOS会询问权限。 用户可以点击是或否。 如果用户点击否,控制不会被解除。 相反,如果用户不断点击开始button,定时器将继续,而屏幕始终是黑色的,用户不能停止定时器或返回。 用户唯一能做的就是杀死应用程序。 UIImagePickerController下一次出现时,它仍然是一个黑屏,如果点击开始,用户不能返回。 我想知道这是否是一个错误。 有什么办法可以检测到相机的权限,以便我们可以决定显示UIImagePickerController吗?

我怎样才能得到通过iPhone中的照片库采摘的图像的名称?

我正在iphone应用程序中从照片库中select一个图像。 我将如何检索实际的图像名称。 在.h类 UIImageView * imageView; UIButton * choosePhotoBtn; 在.m类 -(IBAction) getPhoto:(id) sender { UIImagePickerController * picker = [[UIImagePickerController alloc] init]; picker.delegate = self; if((UIButton *) sender == choosePhotoBtn) { picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } else { picker.sourceType = UIImagePickerControllerSourceTypeCamera; } [self presentModalViewController:picker animated:YES]; } – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissModalViewControllerAnimated:YES]; imageView.image = [info […]