iphone - MPMoviePlayerViewController 上的向下滑动手势

标签 iphone sdk ios4 mpmovieplayercontroller

我的应用程序以电影开始,我尝试向下滑动或向下滑动以继续电影,但我不知道为什么手势不起作用,我尝试使用:

[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;
}

最佳答案

- (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];
}

我认为您忘记添加要应用滑动手势识别器的 socket

关于iphone - MPMoviePlayerViewController 上的向下滑动手势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5847437/

相关文章:

iphone - 自定义 UIButton 的发光效果,如信息 UIButton

iphone - NSUserDefaults EXC_BAD_ACCESS

ios - Facebook SDK swift : problems with fetching user data (segue)

ios - 使用混合的 Swift 和 Objective-C 代码创建框架

iphone - 多个复选框选择值显示到 TableView 的不同单元格中

ios - 这个Mac SDK可以在iOS应用程序中运行吗?

iphone - 动画导航栏标题

android - 开发跨平台移动应用

iPhone:从前台/后台切换回来后重新加载 View ?

iphone - UITableView 单元格提供错误信息