1

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

4

1 回答 1

3

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

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];
于 2012-05-02T05:09:14.770 回答