在iOS 7中,摄像头有几种模式:视频、照片、正方形和全景。在我正在开发的应用程序中,我们允许用户使用相机拍照。我们只想要正方形的图片,所以我们让用户在之后裁剪图片。
有没有可能通过编程强制相机只拍摄正方形的照片?
这是我打开摄像头的代码:
-(void) openImagePickerSource:(UIImagePickerControllerSourceType)type
{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = type;
[self presentViewController:imagePicker animated:YES completion:^{}];
}我一直在看文档,但没有找到任何东西。
发布于 2013-10-30 17:52:25
UIImagePickerController有一个名为“allowsEditing”的属性。这将以全屏打开相机,并允许您在拍摄后调整所拍摄照片的大小。
imagePicker.allowsEditing = YES;
imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *pic = (UIImage *)[info objectForKey:UIImagePickerControllerEditedImage];
}https://stackoverflow.com/questions/19003790
复制相似问题