in Education by
I'm writing an iPhone app with Cocoa in xcode. I can't find any tutorials or sample code that shows how to take photos with the built in camera. How do I do this? Where can I find good info? Thanks! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Just Copy and paste following code into your project to get fully implemented functionality. where takePhoto and chooseFromLibrary are my own method names which will be called on button touch. Make sure to reference outlets of appropriate buttons to these methods. -(IBAction)takePhoto :(id)sender { UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { [imagePickerController setSourceType:UIImagePickerControllerSourceTypeCamera]; } // image picker needs a delegate, [imagePickerController setDelegate:self]; // Place image picker on the screen [self presentModalViewController:imagePickerController animated:YES]; } -(IBAction)chooseFromLibrary:(id)sender { UIImagePickerController *imagePickerController= [[UIImagePickerController alloc] init]; [imagePickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; // image picker needs a delegate so we can respond to its messages [imagePickerController setDelegate:self]; // Place image picker on the screen [self presentModalViewController:imagePickerController animated:YES]; } //delegate methode will be called after picking photo either from camera or library - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [self dismissModalViewControllerAnimated:YES]; UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; [myImageView setImage:image]; // "myImageView" name of any UIImageView. }

Related questions

0 votes
    I have a UITableViewController, in which I added a UISearchBar as the tableHeaderView using Interface Builder. Then ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 3, 2022 in Education by JackTerrance
0 votes
    I'm writing an iPhone app that takes a photo and then uploads it to a server. How do I upload a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 18, 2022 in Education by JackTerrance
0 votes
    I found the following piece of code from the adw launcher: Object service = launcher.getSystemService("statusbar ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    I want to take all the changes I made in the staging to my working directory. What command should I use to perform this ... B. git reset HEAD C. git reset TAIL D. git change...
asked Dec 23, 2022 in Technology by JackTerrance
0 votes
    can anyone help me.. [NSString stringWithFormat:@"document.getElementsByTagName('body')[0].style.textAlign = ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    As it currently stands, this question is not a good fit for our Q&A format. We expect answers to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I am trying to implement a Settings.Bundle based application. For that, I implement Settings.bundle in my ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I can't figure this one out. I've got an iPhone-only app with an image -- location.png -- ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    I'm designing a service that will comprise a cloud-based database (with a UI for us to manage the data), ... sit behind mobile apps. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    Do I need to use separate Docker containers for my complex web application or I can put all required services in ... in one container? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I would like to use ShellExecute in my C++ program to force the opening of a tiff image with ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    radha is a professional photographer and is working with the multinational photo printing company which device would radha ... forms? Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    When i use graph api to post a picture, everything is ok. The photo is right in the album. The ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 16, 2022 in Education by JackTerrance
0 votes
    I have an app that was designed for the Google 2.2 api (it includes maps) and I want to make it ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I would like to send one request when I scroll the tableview up and another request when I scroll down ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
...