2011-02-01 7 views
0

すべて、 [MPMoviePlayerController]の[完了]ボタンは、ポートレートモードでコントロールを閉じます。 しかし、私がランドスケープに回転すると、[完了]と[トグル全画面表示]ボタンの両方が反応しなくなります。 私のアプリはとてもシンプルなアプリで、didRotatefromInterfaceOrientationメソッドがあり、ムービーフレームの幅と高さをランドスケープに変更し、ランドスケープモードと一致するようにオリジンを変更します。MPMoviePlayerControllerランドスケープモードで応答しないボタン

' - (ボイド)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 ]; 

} `

+0

なぜ値をプログラムで変更するのですか? –

+0

原因私はしない場合、ビューが画面からシフトします。 – user598789

答えて

0

さてここで問題は、私はビューを回転させると`でそれをサイズ変更されたことであった - (ボイド)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation。 ムービープレーヤーが自動的にこれを行うので、必ずしもそうする必要はありません。 フレームのサイズ変更と回転は実際にはボタンが混乱しているため、タップしたときにタッチイベントを受信しませんでした。

関連する問題