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

时间:2011-02-01 17:10:44

标签: iphone objective-c mpmovieplayercontroller

全部,    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 :(得分:0)

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