简体   繁体   中英

How to open camera in small region of view in ios

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. 在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM