2011-05-01 9 views
3

私のアプリケーションはムービーで始まり、スワイプダウンまたはスライドしてムービーを続行しようとしていますが、なぜジェスチャーが機能しないのか分かりません。MPMoviePlayerViewControllerのスワイプ・ダウン・ジェスチャー

[player view].userInteractionEnabled = NO;
-(void) swiped: (UISwipeGestureRecognizer *) sender { 

    NSLog(@"SLIDE DOWN"); 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"sahar3" ofType:@"mov"]; 

    player = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]]; 

    player.moviePlayer.scalingMode = MPMovieScalingModeFill; 
    player.moviePlayer.controlStyle = MPMovieControlStyleNone; 

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedPlaying:) 
               name:MPMoviePlayerPlaybackDidFinishNotification object:[player moviePlayer]]; 

    player.moviePlayer.repeatMode = NO; 
    [self.view addSubview:player.view]; 

} 

- (void)viewDidLoad 
{ 
    NSLog(@"lunched"); 
    UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swiped:)]; 
    swipe.direction = UISwipeGestureRecognizerDirectionDown; 
} 
+0

どんな答えを適用する上でアウトレットを追加するのを忘れ思う: - ?sの –

答えて

4
- (void)viewDidLoad 
{ 
    NSLog(@"lunched"); 
    UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self  action:@selector(swiped:)]; 
    swipe.direction = UISwipeGestureRecognizerDirectionDown; 
//add the following line in your application 
    [self.view addgesturerecognizer:swipe]; 
} 

は、私はあなたがスワイプジェスチャー認識に

+0

yeeeeeesありがとう! –

+0

ムービーを切り替えた後の1つの問題は、それらの間で点滅しています。どのように修正できますか? –

+0

私はあなたがもう少し説明することができませんでした – NIKHIL

2

実装してみ - gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizerを:メソッドを委譲し、YESを返します。

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIGestureRecognizerDelegate_Protocol/Reference/Reference.html

+0

私が試したが、何も –

+0

が設定した起こらなかったジェスチャー認識のメソッドを実装したオブジェクトに委譲しますか? – Stefan

+0

はい、私のコードを試しましたか?またはあなたですか? –

関連する問題