2013-10-03 22 views
2

我要在我的應用程序在屏幕上的小區域打開相機打開相機,但沒有得到如何實現它,因爲相機全屏幕上打開genreally。 enter image description here如何看小區域在IOS

攝像機應該在uiimage視圖區域打開,請指導我如何實現此目的。謝謝。

+0

具有u得到了你的問題的解決方案?我不得不打開相機的UIView,其尺寸爲320 * 273。我也嘗試過AVCam,但沒有成功。 –

回答

3

你應該看看AVCam樣本項目提供蘋果公司。它具有所有功能,您需要爲您的任務。祝你好運!

2

我用我上一篇文章的代碼進行了實驗,並將最終的縮放比例變換((使其成爲全尺寸的那個)進行了實驗,最後我在屏幕中間浮動了一個可愛的微型相機imagePicker,所以!絕對不工作的確切代碼我使用,包括變焦/淡入過渡,是 -

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

你可以通過我的答案here.