2

I have to open camera in my app in small region of screen ,but not getting how to implement it,because camera opens on full screen genreally. enter image description here

The camera should be open in uiimage view region,Plz guide me how to achieve this.Thanks.

Sishu
  • 1,510
  • 1
  • 21
  • 48
  • Have u got solution for your problem ? I have to open camera on UIView whose size is 320*273. I tried AVCam also but didn't get successed. – Nilesh_iOSDev May 28 '15 at 13:03

2 Answers2

3

You should take a look at AVCam sample project provided by Apple. It has all the features you need for your task. Good Luck!

Fahri Azimov
  • 11,470
  • 2
  • 21
  • 29
2

I experimented with the code from my last post, and commented out the final scale transform ((the one which makes it full size) and I ended up with a lovely miniature camera imagePicker floating in the middle of my screen, so it definitely does work! The exact code I used, including the zoom/fade-in transition, is -

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];

imagePickerController.delegate = self;
imagePickerController.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeImage, nil];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;

UIView *controllerView = imagePickerController.view;

controllerView.alpha = 0.0;
controllerView.transform = CGAffineTransformMakeScale(0.5, 0.5);

[[[[UIApplication sharedApplication] delegate] window] addSubview:controllerView];

[UIView animateWithDuration:0.3
              delay:0.0
            options:UIViewAnimationOptionCurveLinear
         animations:^{
             controllerView.alpha = 1.0;
         }
         completion:nil
];

[imagePickerController release];

you can go through my answer here.

Community
  • 1
  • 1
D-eptdeveloper
  • 2,430
  • 1
  • 16
  • 30