【问题标题】:How to show MPMoviePlayerController controls?如何显示 MPMoviePlayerController 控件?
【发布时间】:2012-08-23 07:52:44
【问题描述】:

我有 MPMoviePlayerController,我想以编程方式显示控件,例如在用户点击之后,或模拟用户点击。

我该怎么做? 谢谢。

【问题讨论】:

  • 现在检查是否可以添加图片..

标签: objective-c ios xcode mpmovieplayercontroller


【解决方案1】:

以下列方式创建 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;

【讨论】:

    【解决方案2】:

    我想有人已经回答了这个问题here

    最初将controlStyle 属性设置为MPMovieControlStyleNone,然后在一秒钟后使用[performSelector:withObject:afterDelay:1] 将其设置为MPMovieControlStyleFullscreen。它运行良好,在用户点击视频之前不会出现控件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-03
      • 2012-01-15
      • 1970-01-01
      • 2011-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多