我有一个应用程序,我在视图上显示视频。但是,当我在 iOS 中单击全屏模式时,它会在显示视频时崩溃。这是我的代码:
-(void)viewDidLoad
{
MPMoviePlayerController *mc = [[MPMoviePlayerController alloc] initWithContentURL:nil];
mc.shouldAutoplay = NO;
mc.controlStyle = MPMovieControlStyleEmbedded;
NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@"01 01. Welcome" withExtension:@"mov"];
mc.contentURL = contentURL;
[mc prepareToPlay];
mc.view.frame = self.test.bounds;
[self.test addSubview:mc.view];
self.testvideo = mc;
testvideo.fullscreen=YES;
}
我正在将播放器控制器添加到另一个名为 test 的视图中。当我单击全屏按钮时,应用程序崩溃并显示错误消息:
-[UIView trackRectForBounds:]: unrecognized selector sent to instance 0xa171ec0
2013-09-03 15:49:35.178 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView trackRectForBounds:]: unrecognized selector sent to instance 0xa171ec0'