用摄像头画面做 view 背景的代码例子

This action starts camera as a backgroud of the view:-
-(IBAction)btnStartCamera_TouchUpInside{

picker = [[UIImagePickerController alloc] init];
#if TARGET_IPHONE_SIMULATOR
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.view = viewCategoryCamera;
#elif TARGET_OS_IPHONE
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = NO;
[picker.view addSubview:viewCategoryCamera];
//picker.cameraOverlayView = viewCamera;
#endif
[self presentModalViewController:picker animated:YES];
}
This action stops camera:-
-(IBAction)btnStopCamera_TouchUpInside:(id)sender{

[self dismissModalViewControllerAnimated:YES];
[self.navigationController popToRootViewControllerAnimated:YES];
}

viewCategoryCamera 就是你的 view


你可能感兴趣的:(用摄像头画面做 view 背景的代码例子)