将 UIActivityIndicator 连接到 UIButton
对于所有这些 Xcode 东西来说都是新的 - 我有一些链接到电影和电影的 UIButton。 我的网站上的音乐文件 - 它们工作正常,只是在加载 MoviePlayer 时有一些滞后时间,看起来好像什么也没发生。
我想设置一个 UIActivityIndicator - 我无法找到一个简单的方法来做到这一点。
如果是这样,我需要每个按钮一个吗?
你能帮忙吗? 谢谢卡尔
New to all this Xcode stuff - I have a few UIButton's that links to movie & music files from my web site - they works fine, it's just that there's some lag time while it's loading the MoviePlayer where it seems as if nothing's happening.
I would like to set up an UIActivityIndicator - I can't sem to find a simple way to do it.
And if so, would I need one for each button?
Could you help?
Thanks Carl
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想将 ActivityIndicator 直接添加到按钮,请使用以下一些代码来执行此操作:
这显示了活动视图,但您可以在开头隐藏它,也可以通过其标签访问指示器来切换活动指示器。
If you want to add an ActivityIndicator directly to your button, here's some code to do this:
This shows the activity view, but you could either hide it in the beginning or toggle the activity indicator by accessing the indicator via its tag.
您创建一个活动指示器并将其放在屏幕上您喜欢的位置 - 然后您告诉它在您请求媒体时启动动画,并在收到播放已开始的回调时停止动画。
您可以通过编程方式或在 IB 中执行此操作,创建 IBOutlet,以便您可以告诉指标启动/停止。
You create an activity indicator and put it onscreen where you like - then you tell it to startAnimating when you request the media, and stopAnimating when you get a callback that the playback has begun.
You can do this programmatically or in IB, creating an IBOutlet so you can tell the indicator to start/stop.