如何让 `-[MPMoviePlayerController backgroundView]` 立即显示?
目前我的 -[MPMoviePlayerController backgroundView]
直到电影加载足够后才会出现。因此,我放置在那里的 UIActivityIndicatorView
不会立即出现。这让我发疯。找到的唯一解决方案是将重复的指示器视图放置在背景视图和-[MPMoviePlayerController view]
之间。但这看起来不正常,而且绝对是视图层次结构黑客,不能保证正常工作。如果背景视图立即显示,一切都会神奇地进行。
如何在电影加载之前立即制作背景视图?
Currently my -[MPMoviePlayerController backgroundView]
does not appear until movie loaded enough. So UIActivityIndicatorView
which I placed on there does not appear immediately. This drives me crazy. The only solution have been found is placing duplicated indicator-view somewhere between background-view and -[MPMoviePlayerController view]
. But this does not look regular, and definitely a view hierarchy hack which is not guaranteed to work properly. If the background-view shows immediately, all will work magically.
How can I make the background-view immediately before movie loaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要使用backgroundView,而是使用moviecontroller本身的视图...
以下步骤(假设您的
MPMovieControllerPlayer
实例名为moviePlayerController
并且您的UIActivityIndicatorView
实例称为activityIndicatorView
)将您的 UIActivityIndicatorView 添加到 MPMoviePlayerController 视图之上(例如
[moviePlayerController.view addSubview:activityIndixatorView];
)开始为活动指示器设置动画
注册
MPMoviePlayerLoadStateDidChangeNotification
在上述通知的处理程序中,注意
moviePlayerController.loadState & MPMovieLoadStatePlayable == MPMovieLoadStatePlayable
如果满足上述条件,则隐藏您的活动指示器
Do not use the backgroundView but the view of the moviecontroller itself...
Following steps (assuming your
MPMovieControllerPlayer
instance is calledmoviePlayerController
and yourUIActivityIndicatorView
instance is calledactivityIndicatorView
)Add your UIActivityIndicatorView on top of the MPMoviePlayerController view (e.g.
[moviePlayerController.view addSubview:activityIndixatorView];
)Start animating the activity indicator
Register for
MPMoviePlayerLoadStateDidChangeNotification
Within the handler of the above notification, watch out for
moviePlayerController.loadState & MPMovieLoadStatePlayable == MPMovieLoadStatePlayable
If the above condition is matched, hide your activity indicator
我不确定是否可以显示 UIActivityIndicator在全屏模式下通过 MPMoviePlayerController? 可能会对您有所帮助
I am not sure but Can a UIActivityIndicator be displayed over a MPMoviePlayerController in full screen mode? may help you a bit