Created
December 15, 2012 02:06
-
-
Save ChrisRisner/4290602 to your computer and use it in GitHub Desktop.
iOS Day 21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info | |
{ | |
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; | |
[self.imageView setImage:image]; | |
[self dismissViewControllerAnimated:YES completion:nil]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)tappedUseCamera:(id)sender { | |
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; | |
picker.sourceType = UIImagePickerControllerSourceTypeCamera; | |
picker.delegate = self; | |
[self presentViewController:picker animated:YES completion:nil]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)tappedUseCamera:(id)sender { | |
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { | |
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; | |
picker.sourceType = UIImagePickerControllerSourceTypeCamera; | |
picker.delegate = self; | |
[self presentViewController:picker animated:YES completion:nil]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface ViewController : UIViewController <UIImagePickerControllerDelegate> | |
- (IBAction)tappedUseCamera:(id)sender; | |
@property (weak, nonatomic) IBOutlet UIImageView *imageView; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment