MPMoviePlayerController和自定义控件iOS8
=================== 我的问题是只有当播放器全屏运行时才出现iOS8。HandleTap手势:不被调用,而且当我进入全屏时,自定义控件视图消失 有什么想法吗? 提前谢谢 “getContainerViewName”方法有以下更改:MPMoviePlayerController和自定义控件iOS8,ios,uiview,ios8,uigesturerecognizer,mpmovieplayercontroller,Ios,Uiview,Ios8,Uigesturerecognizer,Mpmovieplayercontroller,=================== 我的问题是只有当播放器全屏运行时才出现iOS8。HandleTap手势:不被调用,而且当我进入全屏时,自定义控件视图消失 有什么想法吗? 提前谢谢 “getContainerViewName”方法有以下更改: - (UIView*)getContainerView { UIView *playerControls = (self.videoPlayer.view ? self.videoPlayer.view : self.view);
- (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];
}
}
自定义控件视图将响应触摸,并且也将可见。希望这能帮助有需要的人。谢谢@Drd,这帮助我走出了MPMoviePlayerController形状的绝望深渊:)
- (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]) {
return@"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 {
return@"MPSwipableView";
}
}
NSLog(@"player ERROR : getContainerViewName");
return nil;
}