2014-02-08 5 views
1

아직 코드에서보기를 만드는 데 좋지 않습니다. 그래서 이것은 아마도 간단한 질문 일 것입니다. 내 아이 패드 응용 프로그램에서iOS 7의 모달보기 또는 양식 시트에 현재 UIImagePickerController가 있습니까?

나는이 이미지 선택기를하고 난 화면이나 formsheet 센터 화면의 중심 500x500 모달보기에서 제시 하 고 싶습니다 :

_imagePicker = [[UIImagePickerController alloc] init]; 
_imagePicker.delegate = self; 
_imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
_imagePicker.allowsEditing = NO; 
_imagePicker.navigationBar.tintColor = [UIColor redColor]; 
_imagePicker.navigationBar.backgroundColor = [UIColor greenColor]; 

이 지금은 모두 무엇을해야합니까 모달보기 또는 양식 시트를 만들고 그 안에 이미지 선택 도구를 표시 하시겠습니까?

는 (나는 많은 예제를 통해보고 및 Q & A와 단순한 답을 찾을 수 없습니다. 당신의 도움을 주셔서 감사했습니다!)

답변

1

폼 시트는 모달 프리젠 테이션 형식입니다. 프리젠 테이션 전에 뷰 컨트롤러의 modalPresentationStyle 속성을 수정하여이를 변경합니다. 당신이 documentation of UIImagePickerController을 읽으면

_imagePicker.modalPresentationStyle = UIModalPresentationFormSheet; 
[self presentViewController:_imagePicker animated:YES completion:nil]; 

그러나, 당신은 애플이 팝 오버 내부 뷰 컨트롤러를 제시하도록 요구 것을 볼 수 있습니다.

그래서 :

if([_popoverController popoverVisible]) 
{ 
    [_popoverController dismissPopoverAnimated:NO]; 
    _popoverController = nil; 
} 
_popoverController = [[UIPopoverController alloc] initWithContentViewController:_imagePicker]; 
[_popoverController setDelegate:self]; 
[_popoverController presentPopoverFromBarButtonItem:_button permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 
+0

아하, 나는, 레오 나탄를 참조하십시오! 좋아, 글쎄, 내가 그것을 내 Popover 안에 원하는 방식으로 작동 시키려고 노력하고있다.하지만 그것을 시작하는 버튼은 바가 아니다. (테이블 뷰 정적 셀에있다.) popover 화살표가 제대로 작동하지 않는다. 나는 계속 노력할 것이다. 내 popover 문제는 여기에 나열되어 있습니다 : http://stackoverflow.com/questions/21652296/uiimagepickercontroller-in-uipopovercontroller-location-not-working – Kent

+0

@ 켄트 거기에 귀하의 질문에 대한 내 대답을 참조하십시오. –