开发者

How enable iPhone camera buttons (zoom , flash , switch)

开发者 https://www.devze.com 2023-02-28 10:46 出处:网络
I am trying to usecamera 开发者_开发问答for my application but the problem is when I use this code the front camera is disable :

I am trying to use camera 开发者_开发问答for my application but the problem is when I use this code the front camera is disable :

 ipc.cameraDevice = UIImagePickerControllerCameraDeviceRear;

and vice versa !

  ipc.cameraDevice = UIImagePickerControllerCameraDeviceFront;

how can i enable both them together ? I mean ENABLE the switch button to use front and rear camera , !!! all the buttons are disable ! Zoom , Flash , camera switch

CODE :

-(IBAction)takePic {


    USImage.hidden = YES;
    ipc = [[UIImagePickerController alloc]init];

    ipc.delegate = self;
    ipc.sourceType = UIImagePickerControllerSourceTypeCamera; 



    ipc.cameraDevice = UIImagePickerControllerCameraCaptureModePhoto;
    ipc.cameraViewTransform = YES;

    [self presentModalViewController:ipc animated:YES];
}


I use this code and it lets me switch the camera perfectly fine:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];


you can't use them at the same time


Just don't provide neither of both lines ;). If you don't set up cameraDevice, the button will be presented (and working like charm) on your ImagePickerController

0

精彩评论

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