2011-05-01 5 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

Одна проблема после переключения фильмов там мигает между ними, как я могу ее исправить? –

+0

Я не понял, вы можете объяснить немного больше – NIKHIL

2

Попробуйте реализации - gestureRecognizer: shouldRecognizeSimultaneouslyWithGestureRecognizer: делегировать метод и вернуть YES.

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

+0

Я пытался, но ничего не произошло –

+0

вы установите этот жест распознаватель-х делегировать объект, в который вы реализовали метод? – Stefan

+0

Да, вы пробовали мой код? или ваш? –

Смежные вопросы