来自xib的cameraOverlayView

时间:2014-08-12 00:08:31

标签: ios xcode uiimagepickercontroller

我一直在寻找一段时间,似乎无法找到明确的方法。我发现的任何链接都已过时。我正在推出这样的相机

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.


    //Get the camera
    self.imagePicker = [[UIImagePickerController alloc] init];
    self.imagePicker.delegate = self;
    self.imagePicker.allowsEditing = NO;
    self.imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.imagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:self.imagePicker.sourceType];
    self.imagePicker.showsCameraControls = NO;
    self.imagePicker.wantsFullScreenLayout = YES; //<-- This does not work in iOS7


    //set our custom overlay view


    [self presentViewController:self.imagePicker animated:NO completion:nil];

}

我有一个连接到名为ControllsViewController的xib的ViewController。我不知道如何将其分配给self.imagePicker.cameraOverlayView =。谁能在这帮助我?

1 个答案:

答案 0 :(得分:1)

您需要使用xib实例化ControllsViewController。假设你有一个名为&#34; ControllsViewController&#34;的xib文件。在你的主要包中:

ControllsViewController *overlayViewController = [ControllsViewController alloc] initWithNibName:@"ControllsViewController" bundle:nil];
self.imagePicker.cameraOverlayView = overlayViewController.view;

您可能希望将overlayViewController分配给属性以保持它。