0

MPMoviePlayerController을 누르면 아무런 변화가 없습니다. 아무도 내가 UITapGestureRecognizer을 설정하는데 잘못하고있는 것을 볼 수 있습니까?MPMoviePlayerController에 UITapGestureRecognizer 추가

- (void) playMovie : (NSString *) urlString{ 

    self.movieURLString = urlString; 

    NSURL *movieURL = [NSURL URLWithString:self.movieURLString]; 

    self.moviePlayer = [[MPMoviePlayerController alloc] init]; 
    [self.moviePlayer setShouldAutoplay:YES]; 
    [self.moviePlayer setContentURL:movieURL.absoluteURL]; 
    [self.moviePlayer setMovieSourceType:MPMovieSourceTypeFile]; 
    self.moviePlayer.controlStyle = MPMovieControlStyleNone; 

    self.moviePlayer.view.frame = self.movieView.frame; 

    /* add tap handler */ 
    UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showControls:)]; 
    singleFingerTap.delegate = self; 

    //EDIT: this line somehow didn't make into my OP 
    [self.moviePlayer.view addGestureRecognizer:singleFingerTap]; 

    self.moviePlayer.view.backgroundColor = [UIColor clearColor]; 
    [self.view addSubview:self.moviePlayer.view]; 
    [self.moviePlayer prepareToPlay]; 

    // respond to changes in movie player status 
    [[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(myMovieFinishedCallback:) 
               name:MPMoviePlayerPlaybackDidFinishNotification 
               object:self.moviePlayer]; 

} 

- (void) showControls : (UITapGestureRecognizer *) recognizer { 
    NSLog(@"here"); 
    self.moviePlayer.controlStyle = MPMovieControlStyleEmbedded; 

} 
+0

나는 당신의 게시물에 대한 세부 사항을 확인하지는 않았지만,'MPMoviePlayerController'가 제스처 인식기 몇 개를 사용하고 충돌로 인해 결코 트리거되지 않는다는 사실을 놓치고있는 것 같아요. – Till

답변

0

제스처 인식기를보기에 추가하지 않았습니다. 잘못된 것입니다.

[self.moviePlayer.view addGestureRecognizer:singleFingerTap]; 

당신이 UIGestureRecognizerDelegate 프로토콜의 몇 가지 방법을 구현하는거야 않는 대리자를 설정할 필요는 없습니다.

+0

어쨌든이 코드는 내가 게시 한 코드에 포함되지 않았습니다. 나는 이것을 시도했지만 여전히 응답이 없다. 나는 그것을 얻지 않는다. 감사! – Alex

관련 문제