사용자가 페이지에 착륙 할 때 카메라 유형의 UIImagePickerController가 있습니다. UIImagePickerController 위에 맞춤형 카메라 오버레이를 넣었지만 버튼 이벤트 중 아무 것도 실행되지 않습니다. 이 코드의 대부분은 기본 Apple 코드에서 가져온 것이라는 것을 알고 있으므로 어떤 일이 일어나고 있는지 당황 스럽습니다.UIImagePickerController 오버레이 단추가 실행되지 않음
@interface TakePhotoViewController : UIImagePickerController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
...
- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{
if (self.capturedImages.count > 0)
{
[self.capturedImages removeAllObjects];
}
self.sourceType = sourceType;
self.delegate = self;
if (sourceType == UIImagePickerControllerSourceTypeCamera)
{
/*
The user wants to use the camera interface. Set up our custom overlay view for the camera.
*/
self.showsCameraControls = NO;
/*
Load the overlay view from the OverlayView nib file. Self is the File's Owner for the nib file, so the overlayView outlet is set to the main view in the nib. Pass that view to the image picker controller to use as its overlay view, and set self's reference to the view to nil.
*/
[[NSBundle mainBundle] loadNibNamed:@"CameraOverlay" owner:self options:nil];
float scale = [self getScaleForFullScreen];
self.cameraViewTransform = CGAffineTransformMakeScale(scale, scale);
self.overlayView.frame = self.cameraOverlayView.frame;
self.cameraOverlayView = self.overlayView;
self.overlayView = nil;
}
}
CameraOverlay의 소유자는 TakePhotoViewController입니다. CameraOverlay 내부의 버튼 중 하나는 Touch Up Inside 이벤트를 아래 나열된 출력 함수로 보냅니다.
- (IBAction)outlet:(id)sender {
NSLog(@"outlet");
}
버튼을이 대상과이 동작 방법에 연결하는 코드는 어디에 있습니까? – matt
저는 CameraOverlay에서이 액션 메소드로 컨트롤을 드래그했습니다. 콘센트 메서드 옆에 원이 채워지고 "CameraOverlay.xib - 콘센트 단추 테스트" –
그럼에도 회의적입니다. 결국, 당신은 자신이'outlet' 메소드가 실행되지 않는다고 말했습니다. 나는 당신이 코드에서이 액션 연결을 형성 할 것을 촉구한다. - 당신이'self.cameraOverlayView = self.overlayView;'라고 말한 후, 단추에'addTarget : action : forControlEvents :'를 호출하여 연결을 형성한다. – matt