0
- (UIView*)getContainerView 
{ 
    UIView *playerControls = (self.videoPlayer.view ? self.videoPlayer.view : self.view); 

    NSString* containerViewName = [self getContainerViewName]; **//@"MPSwipableView" gets returned** 
    for(UIWindow* tempWindow in [[UIApplication sharedApplication]windows]){ 
     for(UIView* tempView in [tempWindow subviews]){ 
      if ([[tempView description] rangeOfString:containerViewName].location != NSNotFound){ 
       playerControls = tempView; 
       break; 
      } 
     } 
    } 

    if(playerControls == nil){ 
     NSLog(@"player ERROR : movieDidEnterFullScreen , no view named %@ was found",containerViewName); 
    } 
    return playerControls; 
} 

- (void)addCustomControls 
{ 
//...// 

UIView *controlsPlaceholder = [self getContainerView]; 
    if (controlsPlaceholder) { 
     if (![controlsPlaceholder.subviews containsObject:self.customControls.view]) { 
      [controlsPlaceholder addSubview:self.customControls.view]; 
     }else{ 
      [controlsPlaceholder bringSubviewToFront:self.customControls.view]; 
     } 
    } 
//...// 
    if (self.tapGestureRecognizer == nil) { 
     self.tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; 
     self.tapGestureRecognizer.delegate = self; 
    } 
    if ([Device] is_iPad]) { 
     [self.customControls.view addGestureRecognizer:self.tapGestureRecognizer]; 
    } 
    else { 
     [self.videoPlayer.view addGestureRecognizer:self.tapGestureRecognizer]; 
    } 
} 

===================的MPMoviePlayerController與自定義控件iOS8上

我的問題是隻與iOS8上,而玩家在全屏。 handleTapGesture:不會被調用,而且當我進入全屏時,自定義控件視圖消失。

任何想法? 在此先感謝!

回答

1

的「getContainerViewName」方法有以下變化:

- (NSString*)getContainerViewName 
{ 
    if ([[PSDeviceInfo sharedInstance] is_iOS5]) { 
     return @"UILayoutContainerView"; 
    } 
    if ([[PSDeviceInfo sharedInstance] is_iOS6]) { 
     return @"MPSwipableView"; 
    } 
    if ([[PSDeviceInfo sharedInstance] is_iOS7]) { 
     return @"MPSwipableView"; 
    } 
    if ([[PSDeviceInfo sharedInstance] is_iOS8]) { 
     [email protected]"MPSwipableView"; 
    } 
    NSLog(@"player ERROR : getContainerViewName"); 
    return nil; 
} 

- (NSString*)getContainerViewName 
{ 
    if ([[PSDeviceInfo sharedInstance] is_iOS5]) { 
     return @"UILayoutContainerView"; 
    } 
    if ([[PSDeviceInfo sharedInstance] is_iOS6]) { 
     return @"MPSwipableView"; 
    } 
    if ([[PSDeviceInfo sharedInstance] is_iOS7]) { 
     return @"MPSwipableView"; 
    } 
    if ([[PSDeviceInfo sharedInstance] is_iOS8]) { 
     if (self.playerIsInfullScreen) { 
      return @"UIInputSetContainerView"; 
     }else { 
      [email protected]"MPSwipableView"; 
     } 
    } 
    NSLog(@"player ERROR : getContainerViewName"); 
    return nil; 
} 

自定義控件查看將響應觸摸,它也將是可見的。希望這會幫助有需要的人。

+0

感謝@Drd,這幫助我爬出了MPMoviePlayerController形狀的絕望洞:) – theLastNightTrain 2015-05-04 16:06:55

+0

很高興它很有用! – 2015-05-28 08:13:05