1

タッチの代わりに回転を無視するUIApplicationのbeginIgnoringInteractionEventsのような関数はありますか?私がMPMovePlayerViewController提示したものだけでアプリが回転しないようにする必要があります。

ありがとう

[アップデート]

これが私のコードです-

MPMoviePlayerViewController *mpViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:videoURL]];
[mpViewController shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
[self presentMoviePlayerViewControllerAnimated:mpViewController];
[mpViewController release];

shouldAutorotateToInterfaceOrientation:メソッドとsetStatusBarOrientation:メソッドの両方を追加することで機能しました。シミュレーターで動作します。ただし、ビデオの再生中にiPhoneを回転させると、ステータスバーも回転し、縦向きのままになります。

http://i28.tinypic.com/357mrub.pngでの私の問題の画像

[更新2]

MPMoviePlayerViewControllerをサブクラス化する(そしてshouldAutorotateメソッドを実装する)ことにより、プログラムは適切に回転します。回線が原因でビデオのみが再生されない

[self presentMoviePlayerViewControllerAnimated:mpViewController];

私のサブクラスを受け入れません。

「警告:互換性のないObjective-Cタイプ'struct NoRotate *'、予期される'struct MPMoviePlayerViewController*'の引数1の'presentMoviePlayerViewControllerAnimated:'を個別のObjective-Cタイプから渡す場合 "

4

2 に答える 2

6

提示するビューで、shouldAutoRotateメソッドを実装し、単に「NO」を返します。これにより、電話機はすべての向きの変更を無視します。

于 2010-07-12T15:38:27.113 に答える
0

たぶん、このようにMPMoviePlayerViewControllerをサブクラス化できます

// NotRotatingMoviePlayerViewController.h
@interface NotRotatingMoviePlayerViewController : MPMoviePlayerViewController {
}

@end

// NotRotatingMoviePlayerViewController.m
@implementation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
  return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

@end
于 2010-07-12T15:52:41.573 に答える