bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!

iOS Camera

 

Camera is a device which is used to take the images. In iOS UIImage PickerController class permits programmers to show the familiar Camera interface to their users and ask them to take a photo or shoot a video. The photos taken or the videos shot by the user with the UIImagePickerController class then become accessible to the programmer.

Step 1. Create an View based application.

Step 2. Add a button in ViewController.xib and create IBAction for the button.

Step 3. Add an image view and create IBOutlet like as viewImage.

Step 4. Change ViewController.h as follows –

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController<UIImagePickerControllerDelegate>

{

UIImagePickerController *imagePicker;

IBOutlet UIImageView * viewImage;

}

- (IBAction)showCamera:(id)sender;

@end

 

Step 5. Change ViewController.m as follows –

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad

{

[super viewDidLoad];

}

- (void)didReceiveMemoryWarning

{

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

- (IBAction)showCamera:(id)sender {

imagePicker.allowsEditing = YES;

if ([UIImagePickerController isSourceTypeAvailable:

UIImagePickerControllerSourceTypeCamera])

{

imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;

}

else{

imagePicker.sourceType =

UIImagePickerControllerSourceTypePhotoLibrary;

}

[self presentModalViewController:imagePicker animated:YES];

}

-(void)imagePickerController:(UIImagePickerController *)picker

didFinishPickingMediaWithInfo:(NSDictionary *)info{

UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];

if (image == nil) {

image = [info objectForKey:UIImagePickerControllerOriginalImage];

}

viewImage.image = image;

}

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{

[self dismissModalViewControllerAnimated:YES];

}

@end

"0 Responses on iOS Camera"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

top

Sales Offer

  • To avail this offer, enroll before 05th December 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free iOS Camera.