1

I am trying to add some basic functionality to a camera application.

The app works like this: You press the camera button somewhere in the app, the camera activates and then gives you some extra basic functionality aside from the flash, switchcameras, cancel and take picture buttons.

Having clicked through quite a bit of search results it seems like only a new cameraoverlay is possible.

Now, I've managed to show some text or a button on itsself somewhere on the camera screen following the scanning example on musicalgeometry.com.

But what I'm trying to do here is add an entire view, constructed in IB, as a cameraOverlay. (for example just a toolbar with some buttons and the rest is blank).

Can I use storyboards for this or is this easier working with Nib files? Or can the toolbar be programmatically added to a UIView so it can serve as cameraOverlay?

I would think the latter (programmatically) is the most straight forward but I haven't been able to find any examples for either possible solution so anything is welcome.

This is the basic overlay code from the example:

- (void) viewDidAppear:(BOOL)animated {
    OverlayView *overlay = 
    [[OverlayView alloc] initWithFrame:CGRectMake(
    0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];

    // Create a new image picker instance:
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];

    // Set the image picker source:
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    // Hide the controls:
    picker.showsCameraControls = NO;
    picker.navigationBarHidden = YES;

    // Make camera view full screen:
    picker.wantsFullScreenLayout = YES;
    picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, 
        CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);

    // Insert the overlay:
    picker.cameraOverlayView = overlay;

    // Show the picker:
    [self presentModalViewController:picker animated:YES];
    [picker release];

    [super viewDidAppear:YES];
}
thejartender
  • 9,339
  • 6
  • 34
  • 51
BossBols
  • 175
  • 12
  • you can add an entire view with a toolbar and set transparency for the rest of the view. This is the way Apple suggests it in the docs as well. "Discussion You can use an overlay view to present a custom view hierarchy on top of the default image picker interface. The image picker layers your custom overlay view on top of the other image picker views and positions it relative to the screen coordinates. If you have the default camera controls set to be visible, incorporate transparency into your view, or position it to avoid obscuring the underlying content." – Vlad Apr 18 '12 at 14:56
  • Thanks. I have seen this, but for some reason (mindblock) cannot comprehend how to get the complete view connected to code. The photopicker example shows a toolbar by itsself in a nib file, How can I recreate this in storyboard though since the creation of it is not explained? – BossBols Apr 18 '12 at 18:19

0 Answers0