2012-07-09 19 views
0

我在屏幕的左上角有一个UIButton。使用iOS模拟器,我可以轻松触摸按钮上最左上角最左侧的部分。它按预期工作:使用MPMoviePlayerController的视图后UITouch被阻止

enter image description here

但使用MPMoviePlayerController后,在该地区时,按下按钮不起作用! (可以更大/更小)。听起来很疯狂!

MPMoviePlayerController代码:

if (!_player) { 
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];   

    NSError *setCategoryErr = nil; 
    NSError *activationErr = nil; 
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryErr]; 
    [[AVAudioSession sharedInstance] setActive: YES error: &activationErr]; 

    VCRoot* root = [[ApplicationManager sharedManager] rootViewController]; 

    _player = [[MPMoviePlayerController alloc] init]; 
    _player.movieSourceType = MPMovieSourceTypeStreaming; 
    _player.view.hidden = YES; 
    [root.view addSubview:_player.view]; 

    [[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(moviePlayerStateChanged:) 
               name:MPMoviePlayerLoadStateDidChangeNotification 
               object:nil]; 
} else { 
    [_player stop]; 
} 

_player.contentURL = [channel url]; 

[_player setInitialPlaybackTime:-1.0]; 
[_player play]; 

注:

我试着用insertSubview: AtIndex:0加入_player.view,试图setIsUserInteractionEnabled = NO,试图setAlpha = 0.f,一切都没用。我甚至增加一条,作为一个不同的看法的一个子视图。

但是:

当我停止播放器,并删除认为,这一区域又是可触摸:(

回答

0

出的所有的事情我想......最后:

_player.view.frame = CGRectMake(-100, -100, 1.f, 1.f);

工作!