iphone 3gs相机叠加只显示白色屏幕

时间:2012-07-09 06:31:23

标签: iphone camera overlay iphone-4

我正在创建简单的自定义相机应用程序。 所以。我试图自定义闪光灯设置按钮和捕捉的按钮。 它适用于iPhone4和iPhone4s ......但遗憾的是......它在iPhone3gs上显示白屏。 有什么问题?

#define CAMERA_TRANSFORM_X 1
#define CAMERA_TRANSFORM_Y 1

#define SCREEN_WIDTH  320
#define SCREEN_HEIGTH 480

- (void) showCamera
{    
    overlay = [[CustomOverlayView alloc]
               initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];
    overlay.delegate = self;

    self.picker = [[UIImagePickerController alloc] init];
    self.picker.delegate = self;
    self.picker.navigationBarHidden = YES;
    self.picker.toolbarHidden = YES;
    self.picker.wantsFullScreenLayout = YES;
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.picker.showsCameraControls = NO;
    self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
    self.picker.cameraOverlayView = overlay;
    [self.view addsubview self.picker.view];
}

1 个答案:

答案 0 :(得分:0)

在根视图控制器viewDidLoad方法中调用showCamera方法,如果不使用IB,则在其init方法中调用。

您应该使用

显示相机控制器
[self.navigationController presentModalViewContoller:self.picker animated:NO];