我正在制作我已经为 iPhone 制作的应用程序的 iPad 版本,这意味着我知道这段代码有效。我使用 self.bounds 而不是静态值,因此大小与文档一致。
问题是:当我打开一个视频时,一切都会显示出来。但是,我无法按控制栏上的任何内容。
我在谷歌或这里都找不到有这个问题的人......
任何人都知道问题可能是什么?
汤姆
代码:
mediaController = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];
NSLog(@"%@", [[NSNotificationCenter defaultCenter] observationInfo]);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackIsReady:)
name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
object:mediaController];
CGRect rect = self.view.bounds;
//mView = [[UIView alloc] initWithFrame:CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height - 30)];
//mView.backgroundColor = [UIColor clearColor];
[mediaController.view setFrame:rect];
[self.view addSubview:mediaController.view];
//[self.view addSubview:mView];
hud = [[MBProgressHUD alloc] initWithView:self.view];
hud.labelText = @"Loading video...";
[self.view addSubview:hud];
[hud show:YES];
[mediaController prepareToPlay];
mediaController.shouldAutoplay = NO;
mediaController.controlStyle = MPMovieControlStyleDefault;
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)];
tapRecognizer.delegate = self;
//[self.view addGestureRecognizer:tapRecognizer];
[mediaController.view addGestureRecognizer:tapRecognizer];