开发者

Taking a picture without the image picker (modal view)

I'm trying to take a picture without displaying the image picker. I use the takePicture method.

Here is my code:

if ([UIImagePickerControlle开发者_运维百科r isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]) {
    UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
    self.imageController = ipc;
    [ipc release];

    self.imageController.delegate = self;

    self.imageController.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.imageController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
    self.imageController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;

    [self.imageController takePicture];
}

where imageController is @property(nonatomic,retain) UIImagePickerController* imageController;

My class is @interface PhotoVideo : NSObject <UIImagePickerControllerDelegate,UINavigationControllerDelegate>

Unfortunately, the picture isn't taken because -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info is never called.

Thanks for your time :)


My understanding is that you still need to present the UIImagePickerController, as a modal view controller or a popover, before you can use -takePicture. You can overlay a custom view though when you don't want to use the standard controls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜