我正在调用UIImagePickerController的方法takePicture方法用iPhone编程图片
但是我想禁用快门动画,只是在拍摄照片时将屏幕保持原样(并禁用声音)。
更新 我现在正在使用AVFoundation API来获取图像,但是屏幕上不再显示相机的内容。我应该初始化UIImagePickerController只是为了在屏幕上显示摄像头的内容吗?
由于
答案 0 :(得分:0)
UIImagePickerController有一些选项,但不是很多。 This other question有一些俗气但可能有效的想法可以禁用它。
要完全控制,您需要使用AVFoundation API。以下是捕获示例:https://developer.apple.com/library/ios/#samplecode/AVCam/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010112
答案 1 :(得分:0)
查看此示例:它使用AVCaptureSession和ImagePicker从视频中捕获图像。 http://developer.apple.com/library/ios/#samplecode/AVCam/Listings/Classes_AVCamCaptureManager_m.html
答案 2 :(得分:-1)
我认为这对3.0很有用。
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:@"public.image"])
{
UIImage *selectedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
UIImage * cameraimage= [self scaleAndRotateImage:selectedImage];
CGRect rect =CGRectMake(0, 0,640,875);
CGImageRef imageRef = CGImageCreateWithImageInRect([selectedImage CGImage], rect);
UIImage *img = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
self.captureimage.image=cameraimage;
NSLog(@"selectedimage width:%f ht:%f",img.size.width,img.size.height);
}
[picker dismissModalViewControllerAnimated:YES];
}