What is iOS Camera

In this article we are reading about “What is 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.
The camera modes built directly into your iPhone, iPad, and iPod touch help you take the ideal photo or video. Swipe left or right on the camera screen to use the different modes. You can choose from photo, square, pano, video, time-lapse, and slo-mo. And on your iPhone 7 Plus and later, photos look better than ever thanks to the depth-of-field effect in Portrait mode.
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 –
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

{

UIImagePickerController *imagePicker;

IBOutlet UIImageView * viewImage;

}

- (IBAction)showCamera:(id)sender;

@end
Step 5. Change ViewController.m as follows –
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#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
So in this article we have read about “What is iOS Camera”.

Comments

Popular posts from this blog

Java Number Class

Java Character Class

What are Web Resources in Microsoft Dynamics 365?