Tag: uiimagepickercontroller

通过imagepicker上传图像到服务器不起作用(需要解决scheme)

作为从这个问题的后续上传图像到服务器不起作用 (你可以find我的PHP文件)我意识到为什么它不工作。 但我不知道解决scheme。 正如你可以在代码中看到的(几行),我把我的图像给php文件,但它不认识它作为一个图像。 所以我希望有人可以帮助它,并知道(可能是明显的)解决scheme: – (IBAction)changepic:(id)sender{ picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewController:picker animated:YES]; } – (void)imagePickerController:(UIImagePickerController *) Picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ double compressionRatio=1; NSData *imageData=UIImageJPEGRepresentation([info objectForKey:UIImagePickerControllerOriginalImage],compressionRatio); while ([imageData length]>50000) { compressionRatio=compressionRatio*0.50; imageData=UIImageJPEGRepresentation([info objectForKey:UIImagePickerControllerOriginalImage],compressionRatio); } UIImage *yourUIImage; yourUIImage = [info objectForKey:UIImagePickerControllerOriginalImage]; imageData = [NSKeyedArchiver archivedDataWithRootObject:yourUIImage]; [[NSUserDefaults standardUserDefaults] setObject:imageData forKey:@"bild"]; […]

使用UIImagePickerController自定义“使用”,“取消”,“重拍”和“反向相机”button事件

我正在制作一个自定义照片select器。 所以我用过 imagePickerController.showsCameraControls = NO; 我已经创build了一个摄像头覆盖视图和使用 imagePickerController.cameraOverlayView = overlayView; 所以,我需要实现自定义button选项,任何人都可以请告诉我如何使用UIImagePickerController自定义button事件? 提前致谢。

如何获得在iPhone画廊的图像的path

我需要从iPhone画廊上传图像,但我没有得到所选图像的path (使用图像select器 ) 在图像select器委托方法,我正在做下面的事情 – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissModalViewControllerAnimated:YES]; imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; NSString *strImagePath = [info valueForKey:UIImagePickerControllerReferenceURL]; NSString *strImagePath1 = [info valueForKey:UIImagePickerControllerMediaURL]; NSLog(@"%@",strImagePath); NSLog(@"%@",strImagePath1); NSLog(@"%@",info); } info字典包含以下关键值 { UIImagePickerControllerMediaType = "public.image"; UIImagePickerControllerOriginalImage = "<UIImage: 0x16adc0>"; UIImagePickerControllerReferenceURL = "assets-library://asset/asset.PNG?id=1000000153&ext=PNG"; } 我使用的关键UIImagePickerControllerReferenceURL的值作为图像path上传到FTP,但我不能上传文件,可能是我采取的path是不正确的。 任何人都可以帮助我,我怎么能采取图像采集器采摘的图像的实际path

将图像剪裁成覆盖图的形状 – iOS

我使用pickerController的视图和uinavigationcontrollerdelegate添加覆盖,如下所示。 -(void)navigationController:(UINavigationController *)navigationController didShowViewController: (UIViewController *)viewController animated:(BOOL)animated{ if ([navigationController.viewControllers count] == 3) { CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height; UIView *plCropOverlay = [[[viewController.view.subviews objectAtIndex:1]subviews] objectAtIndex:0]; plCropOverlay.hidden = YES; int position = 0; if (screenHeight == 568) { position = 124; } else { position = 80; } CAShapeLayer *circleLayer = [CAShapeLayer layer]; UIBezierPath *path2 = […]

复制相机应用程序的旋转,以横向IOS 6 iPhone

嗨,我试图复制相同的旋转,可以看到相机应用程序时,方向转移到风景。 不幸的是我没有运气。 我需要设置为UIImagePickerController自定义cameraOverlayView。 从这张肖像(B是UIButtons) |———–| | | | | | | | | | | | | | BBB | |———–| 到这个景观 |—————-| | B | | | | B | | | | B | |—————-| 换句话说,我想button坚持原来的肖像底部,并在其中心旋转。 我正在使用故事板,并启用Autolayout。 任何帮助是极大的赞赏。

UIImagePickerController卡在selectvideo后,在iOS10模拟器上压缩video

我有这个应用程序,总是在iOS9上正常工作,现在我已经将swift代码迁移到3.0,并添加所需的plist行来访问照片库。 在模拟器上使用UIImagePickerController从相机胶卷中选取一个video(通过拖动预先加载)时,它总是卡在“压缩video”上,不callback委托方法。 @IBAction func videoFromLibrary(_ sender: UIBarButtonItem) { picker.allowsEditing = false picker.sourceType = .photoLibrary picker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .photoLibrary)! picker.modalPresentationStyle = .popover present(picker, animated: true, completion: nil) picker.popoverPresentationController?.barButtonItem = sender } 使用真正的设备,它工作正常,它似乎是一个苹果的错误,我想知道如果有人有这个问题,或者我失去了一些东西,使UIImagePickerController正确地使用模拟器上的video(或者如果有解决方法) 。

cameraOverlayView防止编辑与允许编辑

编辑照片后(移动和缩放)在我的应用程序中正常工作: [imagePicker setAllowsEditing:YES]; 但是,如果我也使用cameraOverlayView,编辑模式不再工作。 屏幕出现,但平底锅和捏手势不会使任何事情发生。 我正在使用您的平均图像select控制器: UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; 我添加一个相机覆盖视图,从自定义视图控制器的视图创build: CameraOverlayViewController *overlayController = [[CameraOverlayViewController alloc] init]; UIView *overlayView = overlayController.view; [imagePicker setCameraOverlayView:overlayView]; 在IB中,该视图设置为允许用户交互和多点触摸,这允许在拍摄照片时缩放和聚焦。 但一旦拍摄照片并进入编辑模式,您将无法平移或缩小以移动或缩放照片。 我错过了什么?

UIImagePickerController以横向录制video

我们如何强制UIImagePickerController控制器仅在横向模式下录制video? 我知道这个class应该用于人像logging,但是我需要把它放在风景中。 发现了几个类似的问题,但没有任何解决scheme适用于我(iOS 6.1)。 例如观察设备的方向不适合我(这个答案 – https://stackoverflow.com/a/2147584/775779 ) 如果我实现像下面这样的UIImagePickerController类: #import "UIImagePickerController+NonRotating.h" @implementation UIImagePickerController (NonRotating) – (BOOL)shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } – (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeRight; } @end 它几乎可以工作,但是在录制过程中我看到一些控制和video方向错误的奇怪行为(结果video是好的)。 1)开始。 取消和录制button在正确的位置,但其他控制错误。 和video旋转。 2)录音。 定时器和video是错误的。 3)录制完成。 都好! 结果video是正确的。 你有什么想法? 更新我需要在录制过程中以横向locking屏幕。

UIImagePickerController在iOS10上崩溃

在iOS10上提供UIImagePickerController与照片库源,我的应用程序崩溃。 在具有相机源的iOS10上以及具有照片库和相机源的iOS9上,该应用不会崩溃。 该应用程序是用Swift 2.2编写的,由Xcode 7.3.1构build。 为什么会发生崩溃? let imagePicker = UIImagePickerController() imagePicker.sourceType = .PhotoLibrary imagePicker.allowsEditing = true imagePicker.delegate = self self.presentViewController(imagePicker, animated: true, completion: nil)

如何子查看相机视图?

我正在制作一个应用程序,让用户看到自己在“镜子”(设备上的前置摄像头)。 我知道使用视图覆盖制作UIImageViewController的多种方式,但是我希望我的应用能够以相反的方式进行创作。 在我的应用程序中,我希望相机视图成为主视图的子视图,不需要快门animation,也不需要捕捉照片或拍摄video,也不需要全屏显示。 有任何想法吗?