Tag: uiimagepickercontroller

从UITableViewCell iOS打开相机

我有一个UITableView和一个UITableViewCell。 在每一个UITableViewCell我想打开画廊或单击图像。 我通常提出像UIImageviewController – (IBAction)takePhoto:(UIButton *)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.allowsEditing = YES; picker.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentViewController:picker animated:YES completion:NULL]; } 我怎样才能从细胞中呈现? Misha 🙂

如何在Swift中转换Objective-C TOCropViewController委托方法?

其实我想要转换TOCropViewController委托方法。我在swift项目中使用了bridge_header和在bridge_header文件中调用TOCropViewController类。然后我把委托方法放在viewcontroller.swift。至于我做到了这一点 let cropViewController = TOCropViewController(image:image) cropViewController.delegate = self self.presentViewController(cropViewController, animated: true, completion: nil) self.imageView.image = image 但是如何在swift中快速转换下面的目标c TOCropViewController委托方法。 #pragma mark – Cropper Delegate – – (void)cropViewController:(TOCropViewController *)cropViewController didCropToImage:(UIImage *)image withRect:(CGRect)cropRect angle: (NSInteger)angle { self.imageView.image = image; [self layoutImageView]; self.navigationItem.rightBarButtonItem.enabled = YES; CGRect viewFrame = [self.view convertRect:self.imageView.frame toView:self.navigationController.view]; self.imageView.hidden = YES; [cropViewController dismissAnimatedFromParentViewController:self withCroppedImage:image toFrame:viewFrame completion:^{ […]

UIImagePickerController在解散时搞乱了tabbar框架

我想在UITabBarController内的UIViewController中显示UIImagePickerController SourceType相机 MediaType kUTTypeMovie 显示UIImagePickerController没有任何问题,但是当解散TabBar下移一半的高度时,它只会有时发生…其他它完全解散。 override func viewDidLoad() { var test: UIButton = UIButton(frame:CGRectMake(140, 200, 100, 100)) test.backgroundColor = UIColor.redColor() test.addTarget(self, action:"presentCamera", forControlEvents: .TouchDown) self.view.addSubview(test) } func presentCamera(){ if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){ imag.mediaTypes = [kUTTypeMovie] imag.delegate = self imag.sourceType = UIImagePickerControllerSourceType.Camera; imag.videoQuality = UIImagePickerControllerQualityType.TypeMedium imag.videoMaximumDuration = 120 imag.allowsEditing = false self.presentViewController(imag, animated: true, completion:{println("showing")}) } } func […]

UIImagePicker冻结

我可以调用图像select器的模式视图控制器,select图像,然后裁剪,但是当我点击“完成”时,它不会执行任何操作,它只是在完成button变灰的情况下挂起。 没有错误,但函数被调用。 – (void)viewDidLoad { self.imgPicker = [[UIImagePickerController alloc] init]; self.imgPicker.allowsImageEditing = YES; self.imgPicker.delegate = self; self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo { userImage.image = img; uploadButton.hidden = NO; [[picker parentViewController] dismissModalViewControllerAnimated:YES]; NSLog(@"called"); } – […]

在UIScrollView中像“移动和缩放”一样裁剪UIImage

如何在UIImagePickerController中创build自定义的“移动和缩放”视图? 我需要移动和缩放我的自定义UIImages,而不是从照片库。 或者也许有办法将UIImage传递给这个视图?

ALAsset valueForProperty:ALAssetPropertyLocation未声明?

这可能看起来太简单了,或者只是让我感到困惑……或者我太累了,不能理性思考。 我正在尝试从使用imagePickerController的相册中获取用户select的UIImage的位置。 – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *pic = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; NSData *data = UIImageJPEGRepresentation(pic, 0.01f); UIImage *image1 = [UIImage imageWithData:data]; bookmarkImage.image = image1; NSLog(@"new image size = %i", [data length]); NSURL *url = [info objectForKey:@"UIImagePickerControllerReferenceURL"]; 4NSLog(@"%@",url); ALAssetsLibraryAssetForURLResultBlock resultBlock = ^(ALAsset *myAsset){ [myAsset valueForProperty:ALAssetPropertyLocation]; }; [self dismissModalViewControllerAnimated:YES]; } 现在,我尝试调用ALAsset的valueForProperty是我遇到麻烦的地方。 这是我得到的错误: 使用未声明的标识符“ALAssetPropertyLocation”。 请帮忙! 这真是令人沮丧…我需要照片的位置…

UIImagePickerController在缩放时显示黑条 – 这是iOS中的错误吗?

编辑 : 有人build议这个post是重复的 ,情况并非如此,因为黑色条纹最初不存在,仿制转换不能解决问题。 我在iPad Air 2上运行这个和目标iOS 8.我有一个UIImagePickerController其showsCameraControls属性设置为NO 。 当在横向启动应用程序,然后放大,这是发生了什么(所有的图像是非裁剪): 出现黑条,可以通过将设备方向更改为纵向(也将显示黑条)并将其更改回来。 改为肖像之后: 回到风景(+放大): 奇怪的是,在回到风景之后,缩放滑块在缩放过程中不再可见。 从最初的肖像开始,缩放首先工作,直到一个更改为横向,其中出现一个黑色的酒吧,其中返回到肖像时停留。 将showsCameraControls设置为YES时,不会发生这种情况。 我怎样才能摆脱这个问题? 更新 :苹果宣称已经解决了这个问题在iOS 9。

如何正确裁剪UIImage与UIImagePickerController?

这是我的应用程序的相机覆盖, 黄色正方形表示用户只有该部分(相机内)的照片才会被保存。 这就像庄稼。 当我保存了捕捉图像时,它将保存缩放的照片[放大照片], 我发现,当我拍了一张照片时,它的尺寸是{2448, 3264} 我正在像这样裁剪图像, – (UIImage *)imageByCroppingImage:(UIImage *)image toSize:(CGSize)size { double x = (image.size.width – size.width) / 2.0; double y = (image.size.height – size.height) / 2.0; CGRect cropRect = CGRectMake(x, y, size.height, size.width); CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], cropRect); UIImage *cropped = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef); return cropped; } – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary […]

设置使用iPhone相机拍摄的图像的types

如果我们使用iPhone相机拍摄照片,默认情况下,图像将以JPEG格式保存。 我想保存以PNG等其他格式捕获的图像。 可能吗? 当我们从我们的应用程序调用iPhone相机时,是否有可能从代码中做到这一点,我们可以设置捕获图片后,它必须保存的图像types? 我的意思是在拍照之前打开相机并设置types?

uiimagepickercontroller didfinishpickingmediawithinfo从库中selectvideo时未调用

我正在编写一个应用程序,用户可以从库中select照片和video。 我想在selectvideo时实现自己的video播放器,但应用程序立即启动具有selectbutton的默认video播放器。 didfinishpickingmediawithinfo函数不会被调用。 这仅在selectvideo时发生。 我可以显示选定的照片,因为在照片select的情况下调用委托方法。 为什么仅在从库中selectvideo时才会调用选取器的委托方法? 代码库button点击: //Library access function displays photos and videos stored on the device – (IBAction)selectPhoto:(UIButton *)sender { UIImagePickerController *picker2 = [[UIImagePickerController alloc] init]; picker2.delegate = self; picker2.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker2.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:picker2.sourceType]; picker2.allowsEditing = NO; self.picker2 = picker2; [self.picker dismissViewControllerAnimated:YES completion:^{ [self presentViewController:self.picker2 animated:YES completion:NULL];}]; } 我确实包括在视图控制器中的代表。 我研究过的许多问题都指出了在视图控制器的标题中缺less包含,但我向你保证他们在那里。 这里是包含的代码: @interface […]