Packy
Packy

Reputation: 3573

cameraOverlayView from xib

I have been searching for a while and can not seem to find a clear way of doing this. Any link I did find is outdated. I am presenting a camera like so

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

}

I have a ViewController connected to an xib named ControllsViewController . I have no idea how to assign it to self.imagePicker.cameraOverlayView = . Can anyone help me here?

Upvotes: 1

Views: 1402

Answers (1)

Rengers
Rengers

Reputation: 15228

You need to instantiate the ControllsViewController using the xib. Assuming you have a xib file called "ControllsViewController" in your main bundle:

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

You probably want to assign overlayViewController to a property to keep it around.

Upvotes: 1

Related Questions