我的应用程序以电影开头,我试图向下滑动或向下滑动以继续播放电影,但我不知道为什么手势不起作用,我尝试使用:
[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 :(得分: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];
}
我认为您忘记添加要应用滑动手势识别器的插座
答案 1 :(得分:2)
尝试实现 - gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:委托方法并返回YES。