1

영화를 재생하도록 MPMoviePlayerController를 설정했습니다. 몇 가지 버튼을 가져 오는 동안 동영상에서 터치를 감지하고 싶습니다. 코드 사용 : MPMoviePlayerController 창에서 터치를 감지하고 표준 재생 제어를 계속 수행하는 방법


// The movie's window is the one that is active 
     UIWindow* moviePlayerWindow = [[UIApplication sharedApplication] keyWindow]; 
     // Now we create an invisible control with the same size as the window 
     UIControl* overlay = [[[UIControl alloc] initWithFrame:moviePlayerWindow.frame]autorelease];

// We want to get notified whenever the overlay control is touched 
    [overlay addTarget:self action:@selector(movieWindowTouched:) forControlEvents:UIControlEventTouchDown]; 

    // Add the overlay to the window's subviews 
    [moviePlayerWindow addSubview:overlay]; 

하지만 그때가 나타나지 컨트롤러를 재생 , 나는 touch.how을하지 않는 플레이어 윈도우 나는 플레이어 컨트롤러를 유지하고 계속 접촉을 감지 할 수 추측 때문에? 감사합니다.

답변

1

고유 한 UIView의 하위 클래스를 만들고 오버레이로 추가해야합니다.

-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event의 방법에서는 화면을 터치 할 때 원하는 모든 작업을 수행 할 수 있습니다.

내 프로젝트에서이 작업을 수행했습니다. Interface Builder에서 VideoOverlay (UIView의 하위 클래스)의 디자인을 구현했습니다. 사용자가 상호 작용해야하는 다른 요소를 추가해야하는 경우 훨씬 쉽습니다.

+0

감사합니다.하지만 네이티브 컨트롤러를 사용하기 위해 터치 이벤트를 MPMoviePlayerController에 전달하는 방법은 무엇입니까? – user286472

+0

[[next nextResponder] touchesBegan : withEvent : event]; – mxg

+0

나를 iPad 3.2.1에서 작동하지 않습니다. 그것은 내가하는 것처럼 보이고, 나는 오버레이와 응답하는 플레이어를 둘 다 가질 수 없다 : ( – jv42

관련 문제