iPhone-显示UIImagePickerController

iPhone-显示UIImagePickerController,iphone,uiimagepickercontroller,modalviewcontroller,Iphone,Uiimagepickercontroller,Modalviewcontroller,我在我的应用程序中搜索了一些使用UIImagePickerController的方法,我发现唯一有效的方法是: 在应用程序显示的第一个视图中,放置: self.picker = [[UIImagePickerController alloc] init]; self.picker.sourceType = UIImagePickerControllerSourceTypeCamera; self.picker.showsCameraControls = NO; self

我在我的应用程序中搜索了一些使用UIImagePickerController的方法,我发现唯一有效的方法是:

在应用程序显示的第一个视图中,放置:

self.picker = [[UIImagePickerController alloc] init];
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    self.picker.showsCameraControls = NO;
    self.picker.navigationBarHidden = YES;
    self.picker.wantsFullScreenLayout = YES;

    // Insert the overlay
    self.overlay = [[OverlayViewController alloc] initWithNibName:@"Overlay" bundle:nil];
    self.picker.cameraOverlayView = self.overlay.view;

    [self presentModalViewController:self.picker animated:NO];

你知道另一种(苹果公司允许的)方法可以在视图中包含这样一个摄像头控件,而不必调用presentModalViewController吗?

UIImagePickerController本身就是一个视图控制器,出于明显的原因,它必须以MODAL方式运行

如果根据上面的代码使用它时遇到问题,最可能的问题是您没有将委托分配给选择器,因此当选择器完成时,您不会收到任何消息,也无法访问结果


为选择器的顺利运行指派一名代表。

否。从4.3开始,任何其他方法都需要使用专用(不允许)api

如果您对如何使用私有api感兴趣