【发布时间】:2012-08-23 07:52:44
【问题描述】:
我有 MPMoviePlayerController,我想以编程方式显示控件,例如在用户点击之后,或模拟用户点击。
我该怎么做? 谢谢。
【问题讨论】:
-
现在检查是否可以添加图片..
标签: objective-c ios xcode mpmovieplayercontroller
我有 MPMoviePlayerController,我想以编程方式显示控件,例如在用户点击之后,或模拟用户点击。
我该怎么做? 谢谢。
【问题讨论】:
标签: objective-c ios xcode mpmovieplayercontroller
以下列方式创建 MPMoviePlayerController 对象将为您提供视频控件的接口
yourMoviePlayerController = [MPMoviePlayerController new];
yourMoviePlayerController.controlStyle=MPMovieControlStyleEmbedded;
[yourMoviePlayerController setContentURL:[NSURL fileURLWithPath:videoPath]];
yourMoviePlayerController.backgroundView.hidden = YES;
[yourMoviePlayerController setScalingMode:MPMovieScalingModeAspectFit];
yourMoviePlayerController.shouldAutoplay=YES;
yourMoviePlayerController.movieSourceType = MPMovieSourceTypeFile;
【讨论】:
我想有人已经回答了这个问题here
最初将controlStyle 属性设置为MPMovieControlStyleNone,然后在一秒钟后使用[performSelector:withObject:afterDelay:1] 将其设置为MPMovieControlStyleFullscreen。它运行良好,在用户点击视频之前不会出现控件。
【讨论】: