仅在屏幕的一半显示相机

时间:2012-05-02 04:46:24

标签: ios5 camera

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

1 个答案:

答案 0 :(得分:4)

尝试这个..如果这对你来说没有帮助或者遇到任何问题,请告诉我,我会为你提供一些其他示例代码..

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