Iphone 按钮仅在iOS6中隐藏

Iphone 按钮仅在iOS6中隐藏,iphone,ios,uibutton,mpmovieplayercontroller,Iphone,Ios,Uibutton,Mpmovieplayercontroller,在我的应用程序中,我正在使用MPMoviePlayer播放视频。 我正在电影播放器上添加一个“跳过广告”(你可以在电影播放器的右侧看到)按钮。它在iOS5中工作正常,但当我在iOS6中运行我的应用程序时,当电影播放器变为全屏时,该按钮被隐藏 为什么会这样……有什么想法吗? 帮我克服这个…提前谢谢 下面是在MPMovieplayer上添加按钮的代码,以及屏幕截图 UIButton *skipButton = [UIButton buttonWithType:UIButtonTypeCustom];

在我的应用程序中,我正在使用MPMoviePlayer播放视频。 我正在电影播放器上添加一个“跳过广告”(你可以在电影播放器的右侧看到)按钮。它在iOS5中工作正常,但当我在iOS6中运行我的应用程序时,当电影播放器变为全屏时,该按钮被隐藏

为什么会这样……有什么想法吗? 帮我克服这个…提前谢谢

下面是在MPMovieplayer上添加按钮的代码,以及屏幕截图

UIButton *skipButton = [UIButton buttonWithType:UIButtonTypeCustom];
skipButton.frame = CGRectMake(264.0,195.0, 67.0, 25.0);
[skipButton setTitle:@"" forState:UIControlStateNormal];
skipButton.backgroundColor = [UIColor clearColor];
[skipButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal ];
UIImage *buttonImageNormal3 = [UIImage imageNamed:@"skipad.png"];
UIImage *strechableButtonImageNormal3 = [buttonImageNormal3 stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[skipButton setBackgroundImage:strechableButtonImageNormal3 forState:UIControlStateNormal];
UIImage *buttonImagePressed3 = [UIImage imageNamed:@"skipad.png"];
UIImage *strechableButtonImagePressed3 = [buttonImagePressed3 stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[skipButton setBackgroundImage:strechableButtonImagePressed3 forState:UIControlStateHighlighted];
[skipButton addTarget:self action:@selector(skipAction:) forControlEvents:UIControlEventTouchUpInside];



[[[UIApplication sharedApplication] keyWindow] addSubview:skipButton];
在iOS5中-

在iOS6中-


将Subview带到Front应该可以工作,只需确保正确使用它即可。用法是:

[skipButton.superview bringSubviewToFront:skipButton];
如果这不起作用,您可以按如下方式更改Z位置:

skipButton.layer.zPosition = 1024.0;

为什么不将按钮添加到电影播放器的主窗口而不是主窗口?您可以指定如何添加这样的按钮吗?[self.view addSubview:skipButton];我猜:)@lucamachettelodicoffbrognar我已经试过了..但是没有luckin xcode文档中的MoviePlayer示例有叠加效果,如果你还没有尝试在MyMovieViewcontroller中查找addOverlayView方法。。。听起来对你很有用:)