-
UIImagePickerController - 간단한 카메라 다루기iOS/Objective C 2015. 11. 17. 17:14
더 좋은 방법이있다면 댓글로 달아주시면 감사드리겠습니다.
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:nil];//간단한 카메라 이닛
//delegate
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
UIImage *originalImage, *editedImage;
if (CFStringCompare ((CFStringRef) mediaType, kUTTypeImage, 0) == kCFCompareEqualTo)
{
editedImage = (UIImage *) [info objectForKey:UIImagePickerControllerEditedImage];
originalImage = (UIImage *) [info objectForKey:UIImagePickerControllerOriginalImage];
if (editedImage) { image = editedImage; }
else { image = originalImage; }
}
[[picker parentViewController] dismissViewControllerAnimated:YES completion:nil];
[picker dismissViewControllerAnimated:YES completion:nil];
[self performSelector:@selector(cameraActionWithImage:) withObject:self.pickImage afterDelay:0.5f];
}
참고 소스 : http://dongss.tistory.com/26
'iOS > Objective C' 카테고리의 다른 글
UILabel - 텍스트의 사이즈,색 바꾸기 (0) 2015.11.27 [Xcode] DB접속 프로그램 Sequel Pro for mac (0) 2015.11.25 [Xcode] Xcode PlugIn (0) 2015.11.24 UITextField - 키보드 내리기 (0) 2015.11.16 UITextField (0) 2015.11.16