2012-05-02 96 views
1

我想在iPhone和iPad上只有一半屏幕上顯示相機視圖。我做了很多搜索,但還沒有找到解決方案。只在屏幕的一半上顯示相機

+0

那不是什麼大不了的事首先告訴我...我爲iPhone或iPad編寫代碼? – 2012-05-02 04:52:18

+0

剩餘部分需要的是什麼?爲您的屏幕添加一個攝像頭覆蓋層。接下來,本教程添加一個攝像頭覆蓋層。您可以添加按鈕或背景或圖像或其他任何東西作爲覆蓋層。 –

+0

我已經創建了通用應用程序...對於iPhone和iPad都 –

回答

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]; 
相關問題