2011-03-30 3 views
2

iPad 용 앱을 제작 중이며 가능한 경우 iPad 2 카메라를 사용할 수 있기를 원합니다. iPad 카메라를 iPhone 4와 동일한 방식으로로드하는 코드가 있습니까? 이 코드는 iPhone 버전의이 앱에서 작동하지만 iPad 2는 테스트 할 수 없으며 시뮬레이터는 카메라를 지원하지 않습니다. 다음은 카메라를 사용할 수 있는지 확인한 다음 카메라에 카메라를로드하거나 라이브러리를로드하는 방법입니다.iPad2 카메라 코드는 iPhone4와 동일합니까?

기본적으로 아래 줄이 iPad 2 카메라에서 지원되는지 또는 다른 것을 사용해야합니까? ?

[self presentModalViewController:imagePickerController animated:YES]; 

카메라가 전체 화면으로 표시되고 팝업되지 않도록하고 싶습니다. self가 UINavigationController가있는 경우

- (IBAction) takePhoto:(id)sender { 
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { 
     imagePickerController = [[UIImagePickerController alloc] init]; 
     [imagePickerController setDelegate:self]; 
     [imagePickerController setSourceType:UIImagePickerControllerSourceTypeCamera]; 
     imageView.contentMode = UIViewContentModeScaleAspectFit; 
     [self presentModalViewController:imagePickerController animated:YES]; 
    } else { 
     imagePickerController = [[UIImagePickerController alloc] init]; 
     [imagePickerController setDelegate:self]; 
     [imagePickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; 
     imageView.contentMode = UIViewContentModeScaleAspectFit; 
     UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:imagePickerController]; 
     [popover setDelegate:self]; 
     [popover presentPopoverFromBarButtonItem:sender 
         permittedArrowDirections:UIPopoverArrowDirectionAny 
             animated:YES]; 
    } 
} 

답변

0

예이 확실히를 들어, 작동합니다. 내 애플 리케이션에서 동일한 일을하기 때문에 나는 이것을 안다. 다른 UIViewController에 대한 확신이 없지만 작동 할 것이라고 추론합니다.

관련 문제