1

I have UIViewController with UIToolBar.
And UIToolBar has three buttons [options,pickphotofromlibrary,camera].

When user presses camera button they are taken to custom camera interface[Overlayed].

Code:

- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType

{
if (self.imageView.isAnimating)
{
    [self.imageView stopAnimating];
}

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;

if (sourceType == UIImagePickerControllerSourceTypeCamera)
{
    /*
     The user wants to use the camera interface. Set up our custom overlay view for the camera.
     */
    imagePickerController.showsCameraControls = NO;

    /*
     Load the overlay view from the OverlayView nib file. Self is the File's Owner for the nib file, so the overlayView outlet is set to the main view in the nib. Pass that view to the image picker controller to use as its overlay view, and set self's reference to the view to nil.
     */
    [[NSBundle mainBundle] loadNibNamed:@"overlayView" owner:self options:nil];
    self.overlayView.frame = imagePickerController.cameraOverlayView.frame;
    imagePickerController.cameraOverlayView = self.overlayView;
    self.overlayView = nil;
}


[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];



self.imagePickerController = imagePickerController;

[self.navigationController presentViewController:self.imagePickerController animated:YES completion:nil];

}

So when the user takes the picture I need to push another view which shows them a table view.I have created a nib file but don't know how to proceed further.

Any help would be appreciated..

iPatel
  • 46,010
  • 16
  • 115
  • 137
TryingToLearn
  • 365
  • 2
  • 4
  • 15

2 Answers2

1

You need to use following delegate method of UIImagePickerController

#pragma mark -
#pragma mark - UIImagePickerController Delegate Method

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
     // This code is for dismiss your UIImagePickerController
     [self dismissViewControllerAnimated:YES completion:nil]; 

     //And then write code of your Next ViewController

}
iPatel
  • 46,010
  • 16
  • 115
  • 137
  • aww you beat me to it ): no fair – A'sa Dickens Oct 25 '13 at 12:16
  • But it is a nib file,how to load that??I tried this Viewcontroller *controller = [viewcontroller alloc]initwithnib ..... self.navigation pushviewcontroller:controller animation:yes. But my program evently results in exception – TryingToLearn Oct 25 '13 at 12:36
  • @rak - what is error,, check this question for load nib file ..http://stackoverflow.com/questions/863321/iphone-how-to-load-a-view-using-a-nib-file-created-with-interface-builder – iPatel Oct 25 '13 at 12:42
0

UIImagePickerController has a delegate with a function

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
   // put code here to push the second view controller
}

UIImagePickerViewController Reference

A'sa Dickens
  • 2,045
  • 1
  • 16
  • 21