Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:27:40+00:00 2026-06-18T12:27:40+00:00

i am creating an application which capture an image form iphone camera and display

  • 0

i am creating an application which capture an image form iphone camera and display it in the created application i read some articles in ios developer library and written this code in .m file

- (BOOL) startCameraControllerFromViewController: (UIViewController*) controller
           usingDelegate: (id <UIImagePickerControllerDelegate,
                               UINavigationControllerDelegate>) delegate {

if (([UIImagePickerController isSourceTypeAvailable:
             UIImagePickerControllerSourceTypeCamera] == NO)
        || (delegate == nil)
        || (controller == nil))
    return NO;


UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;

// Displays a control that allows the user to choose picture or
// movie capture, if both are available:
cameraUI.mediaTypes =
    [UIImagePickerController availableMediaTypesForSourceType:
        UIImagePickerControllerSourceTypeCamera];

// Hides the controls for moving & scaling pictures, or for
// trimming movies. To instead show the controls, use YES.
cameraUI.allowsEditing = NO;

cameraUI.delegate = delegate;

[controller presentModalViewController: cameraUI animated: YES];
return YES;
}

also created a button that is linked with this code,
It call this function but the control does not passes to the above function

- (IBAction) showCameraUI {
[self startCameraControllerFromViewController: self
                                usingDelegate: self];
}

And i also have no idea that this code will work or not

Do some one have any better idea.
Thanks,
Arun.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:27:41+00:00Added an answer on June 18, 2026 at 12:27 pm

    First assign delegate to it’s source file

    Then when you pressed your button implement this method open camera controller in your app

    First of all create PopOverController for iPad because we cannot directly open ImagePicker Controller

    EDIT: Added UIPopOverController

    - (IBAction) showCameraUI {
         BOOL hasCamera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
         UIImagePickerController* picker = [[UIImagePickerController alloc] init];
         picker.delegate = self;
         picker.sourceType = hasCamera ? UIImagePickerControllerSourceTypeCamera :    UIImagePickerControllerSourceTypePhotoLibrary;
    
         if (self.popoverController != nil) {
            [self.popoverController dismissPopoverAnimated:YES];
            self.popoverController=nil;
         }
    
         self.popoverController = [[UIPopoverController alloc] initWithContentViewController:picker];
          CGRect popoverRect = [self.view convertRect:[yourBtn frame]
                                       fromView:[yourBtn superview]];
    
         popoverRect.size.width = MIN(popoverRect.size.width, 100) ;
         popoverRect.origin.x = popoverRect.origin.x;
    
         [self.popoverController
         presentPopoverFromRect:popoverRect
         inView:self.view
          permittedArrowDirections:UIPopoverArrowDirectionAny
         animated:YES];
    
        }
    

    And implement this delegate method for get the captured image

    - (void)imagePickerController:(UIImagePickerController *)picker
    didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        [picker dismissModalViewControllerAnimated:YES];
        UIImage* image = [info objectForKey:UIImagePickerControllerOriginalImage];
        UIImage *yourImageView = image;
        if (popoverController != nil) {
         [popoverController dismissPopoverAnimated:YES];
         self.popoverController=nil;
         }
    }
    

    Implement this method if user cancel the controller

    - (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker
    {
        [picker dismissModalViewControllerAnimated:YES];
         if (popoverController != nil) {
         [popoverController dismissPopoverAnimated:YES];
         self.popoverController=nil;
         }
    }
    
    - (void)pickerDone:(id)sender
    {
         if (popoverController != nil) {
         [popoverController dismissPopoverAnimated:YES];
         self.popoverController=nil;
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am creating an application which includes dynamic pages. actually, i created some dynamic
I am creating an application in which I want to capture a image and
I am creating an application which produces some files/directories in my WebContent folder and
i am creating a application which provides custom image cropping…. in which user select
i am creating an application which give options to write articles and submit. I
What I am trying to do is, creating an application which executes some action.
i am creating an application which make uses of tabbar.i have created a function
I'm creating an application which works on Froyo until Jelly Beans. I have two
I'm creating an application which communicates with the device via FT2232H USB/RS232 converter. For
I am creating an application which tracks the users location using GPS, stores the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.