2012-07-09 205 views
0

我正在創建簡單的自定義相機應用程序。 等等。我試圖自定義閃光燈設置按鈕和捕捉按鈕。 它適用於iPhone4和iPhone4s ...但不幸的是..它顯示iPhone3gs上的白色屏幕。 什麼問題?iphone 3gs cameraoverylay只顯示白色屏幕

#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]; 
} 
+0

試圖通過提出的viewController爲[自presentModalViewContoller:self.picker]出示您的相機控制器; – Neo 2012-07-09 06:53:32

+0

謝謝。我應該怎麼做,如果應用程序必須顯示選擇器當它啓動? – Michael 2012-07-09 07:16:50

回答

0

打電話給你showCamera方法在你的根視圖控制器viewDidLoad方法,或在其init方法,如果你不使用IB。

你應該使用

[self.navigationController presentModalViewContoller:self.picker animated:NO];