仅在屏幕的一半上显示

仅在屏幕的一半上显示

本文介绍了仅在屏幕的一半上显示摄像机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iPhone和iPad上仅在屏幕的一半上显示相机视图。我已经做了很多搜索,但没有找到解决方案。

I'd like to display the camera view on only half the screen on both iPhone and iPad. I've done a lot of searching, but haven't found a solution.

推荐答案

试试这个..如果这是没有帮助充满你或面对任何问题,告诉我,我会提供你一些其他的示例代码..

try with this .. if this is not help full for you or facing any problem, tell me i will provide you some other sample code ..

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];

这篇关于仅在屏幕的一半上显示摄像机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-02 21:15