내 자신의 "사진 찍기"버튼을 만드는 데 문제가 있습니다. 기본적으로, 기본 컨트롤을 제거하면 카메라는 더 이상 셔터 애니메이션을 수행하지 않거나 편집 프로세스를 거치지 않고 바로 대리자 메서드로 이동합니다.UiImagePickerController takePicture issues
그래서 여기에 몇 가지 코드가 있습니다. 처음에 나는과 같이 기본 레이아웃을 사용했다 :
이(그런데, 내가 삭제 한 내 하드웨어 가용성을 결정하는 문이있는 경우 - 그들은 관련이없는거야.)이 코드
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = YES;
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
[self presentModalViewController:picker animated:YES];
, 기본 "사진 찍기"버튼을 누르면 셔터 애니메이션이 실행되고 "이동 및 크기 조정"보기가 표시됩니다. "선택"을 누르면 대표가 호출되고 info
을 통해 편집 결과에 액세스 할 수 있습니다.
그래서 여기에 새로운 "초기화 코드"가 있으며 "사진 찍기"버튼이 있습니다. 그런데, 내가 어떤 편집 화면이 표시되지 않습니다 나는 내 사용자 지정 버튼을 쳤을 때, 어떤 애니메이션이 발사되지 않습니다이 예에서 제의 ViewController
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
UIButton *shoot = [[UIButton alloc] initWithFrame:CGRectMake(110, 420, 100, 40)];
[shoot setTitle:@"Shoot" forState:UIControlStateNormal];
[shoot.titleLabel setTextColor:[UIColor whiteColor]];
[shoot addTarget:picker action:@selector(takePicture) forControlEvents:UIControlEventTouchUpInside];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[picker.cameraOverlayView addSubview:shoot];
picker.showsCameraControls = NO;
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
[self presentModalViewController:picker animated:YES];
의 viewDidAppear 방법이 UIImagePickerController를 초기화하고있어, 대리자가 호출된다 바로.
재미있는 점은 위의 예에서 showsCameraControls
속성을 YES
으로 변경하면 내 맞춤 검색 버튼이 첫 번째 예에서 기본 버튼 동작 방식과 정확하게 일치하는 것입니다.
상당히 엉망입니다. didFinishPickingMediaWithInfo
에서해야 할 일이 있습니까? 아니면 이미지 초기화를 위해 뭔가 빠졌습니까?
내가 (응용 프로그램이 5.0 대상) 엑스 코드 4.3과 아이폰 OS 5.1을 사용하고
크게 감사합니다 어떤 도움; 건배! 당신이 당신의 소스로 사진 라이브러리를 사용하는 경우
여기에도 같은 문제가 있습니다. – eugene