title: how to create overlay view for camera and access its methods in iphone sdk?
body: <p>hi i have searched lot of for custom camera overlay view. i have find almost many sample projects but i can't still get perfect answer as i want to get. My question is i want to implement custom camera like <code>instagram</code> or <code>picyou</code> or other social networking apps on button click open custom camera using camera overlay view. i have created custom camera it works fine but i want to access the buttons actions like on capturing image it should navigate to other view by using <code>UINavigationController</code> but its not working.i have used this code for calling camera overlay view.</p>
  
  <pre><code>-(void)OpenCamera
  {
      //create an overlay view instance
      OverlayView *overlay = [[OverlayView alloc]
                              initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];
  
      UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
      picker.delegate = self; 
      //        picker.allowsEditing = YES;
      picker.allowsEditing = NO;
      if (([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])) 
      {
          //set source to video!
          picker.sourceType = UIImagePickerControllerSourceTypeCamera;
          //hide all controls
          picker.showsCameraControls = NO;
          picker.navigationBarHidden = YES;
          picker.toolbarHidden = YES;
          //make the video preview full size
          picker.wantsFullScreenLayout = YES;
          picker.cameraViewTransform =
          CGAffineTransformScale(picker.cameraViewTransform,
                                 CAMERA_TRANSFORM_X,
                                 CAMERA_TRANSFORM_Y);
          //set our custom overlay view
          picker.cameraOverlayView = overlay;
  //        picker.delegate = overlay;
  
  //        UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:picker];
  
          //show picker
          [self presentModalViewController:picker animated:YES];  
      }
      else
      {
          picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
          picker.delegate = self;
          [self presentModalViewController:picker animated:YES];
      }
      [picker release];
  }
  </code></pre>
  
  <p>and this is my camera overlay view .m file code i have used <code>@interface OverlayView : UIView</code></p>
  
  <pre><code>- (id)initWithFrame:(CGRect)frame {
  if (self = [super initWithFrame:frame]) {
      //clear the background color of the overlay
  //    self.opaque = NO;
  //    self.backgroundColor = [UIColor clearColor];
  
      UIToolbar *toolbar = [UIToolbar new];
  
      toolbar.barStyle = UIBarStyleBlackTranslucent;
  
      // create a bordered style button with custom title
  
      UIBarButtonItem *Cancel = [[[UIBarButtonItem alloc] initWithTitle:@"Cancel"
  
                                                                    style:UIBarButtonItemStyleBordered    
  
                                                                   target:self
  
                                                                   action:@selector(btnCancel:)] autorelease];
  
      UIBarButtonItem *flexibleSpace1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
  
      UIBarButtonItem *Camera = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(btnCapture:)] autorelease]; 
  
      UIBarButtonItem *flexibleSpace2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
  
      UIBarButtonItem *Album = [[[UIBarButtonItem alloc] initWithTitle:@"Gallery"
  
                                                                     style:UIBarButtonItemStyleBordered
  
                                                                    target:self
  
                                                                    action:@selector(btnLibrary:)] autorelease];
  
      NSArray *items = [NSArray arrayWithObjects: 
  
                        Cancel,
                        flexibleSpace1,
                        Camera,
                        flexibleSpace2,
                        Album,
  
                        nil];
  
      toolbar.items = items;
  
      // size up the toolbar and set its frame
  
      // please not that it will work only for views without Navigation toolbars. 
  
      [toolbar sizeToFit];
  
      CGFloat toolbarHeight = [toolbar frame].size.height;
  
      CGRect mainViewBounds = self.bounds;
  
      [toolbar setFrame:CGRectMake(CGRectGetMinX(mainViewBounds),
  
                                   CGRectGetMinY(mainViewBounds) + CGRectGetHeight(mainViewBounds) - (toolbarHeight),
  
                                   CGRectGetWidth(mainViewBounds),
  
                                   toolbarHeight)];
  
      [self addSubview:toolbar];
  }
  return self;
  }
  
  -(void)btnLibrary:(id)sender
  {
  
  }
  
  -(void)btnCapture:(id)sender
  {
  
  }
  
  -(void)btnCancel:(id)sender
  {
  //    [self dismissModalViewControllerAnimated:YES];
  }
  </code></pre>
  
  <p>its all working fine but as i said i want to access buttons methods and the UINavigationController for changing the view like <code>instagram</code> and <code>picyou</code> its not working properly can you guide me how to navigate to another view.?</p>