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.

有帮助吗?

解决方案

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top