MPMoviez控制器控制栏无响应

时间:2013-05-20 20:46:06

标签: objective-c ipad mpmovieplayercontroller

我正在制作我已经为iPhone制作的应用程序的iPad版本,这意味着我知道这段代码已经有效了。我使用self.bounds而不是静态值,因此大小与文档一致。

事情是:当我打开视频时,一切都会显示出来。但是,我无法按下控制栏上的任何内容。

我无法在谷歌或此处找到有这个问题的人......

任何人都知道问题可能是什么?

汤姆

代码:

    mediaController = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];

    NSLog(@"%@", [[NSNotificationCenter defaultCenter] observationInfo]);



    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackIsReady:)
                                                 name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
                                               object:mediaController];

    CGRect rect = self.view.bounds;
    //mView = [[UIView alloc] initWithFrame:CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height - 30)];
    //mView.backgroundColor = [UIColor clearColor];
    [mediaController.view setFrame:rect];

    [self.view addSubview:mediaController.view];
    //[self.view addSubview:mView];
    hud = [[MBProgressHUD alloc] initWithView:self.view];
    hud.labelText = @"Loading video...";
    [self.view addSubview:hud];
    [hud show:YES];
    [mediaController prepareToPlay];
    mediaController.shouldAutoplay = NO;
    mediaController.controlStyle = MPMovieControlStyleDefault;

    UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)];
    tapRecognizer.delegate = self;
    //[self.view addGestureRecognizer:tapRecognizer];
    [mediaController.view addGestureRecognizer:tapRecognizer];

0 个答案:

没有答案