首页 文章

MPMoviePlayerController完成按钮在横向模式下无响应

提问于
浏览
0

全部,MPMoviePlayerController中的“完成”按钮在纵向模式下取消控制 . 但是,当我旋转到横向时,Done和Toggle全屏按钮都变得无响应 . 我的应用程序是一个非常非常简单的应用程序,只有didRotatefromInterfaceOrientation方法,我将电影帧宽度和高度更改为横向并更改原点以匹配landscapemode .

` - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {//更新视图的框架 . CGRect newFrame = [[UIScreen mainScreen] applicationFrame];

newFrame.origin.x = - (newFrame.size.width / 2);
newFrame.origin.y = - (newFrame.size.height / 2);

[[self view] setBounds:newFrame];
[[self view] setCenter:CGPointMake( [[self view] bounds].size.width / 2, [[self view] bounds].size.height / 2)];
[self view].userInteractionEnabled = YES;

// Update the frame of the movie player.
newFrame = [[UIScreen mainScreen] applicationFrame];
if( fromInterfaceOrientation == UIInterfaceOrientationPortrait || fromInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
    newFrame.size.width = newFrame.size.height;
    newFrame.size.height = [[UIScreen mainScreen] applicationFrame].size.width;
}
newFrame.origin.x = - (newFrame.size.width / 2);
newFrame.origin.y = - (newFrame.size.height / 2);
[[[self moviePlayer] view] setFrame:newFrame];
[[[self moviePlayer] view ] setUserInteractionEnabled:YES ];

}`

1 回答

  • 0

    那么问题是我在旋转视图并在` - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation中调整它的大小 . 您不需要这样做,因为电影播放器会自动为您执行此操作 . 调整框架大小和旋转实际上使按钮混乱,因此在敲击时没有接收到触摸事件 .

相关问题