我有一个表格,其中包含从网络加载的图像。我希望在加载时有一个动画加载屏幕。
我尝试(成功)使用 UIImageView 并使用动画属性。但是我希望加载动画能够同步。最干净的方法是什么?
我尝试使用NSTimer
。我会使用 NSDate 来获取毫秒 = m。然后 (m * 500) % 4 得到每 2 秒 4 帧。我无法让它发挥作用。我还觉得同时运行 10 到 20 个计时器有点混乱。我在想的一件事是拥有一个具有 NSMutableArray
的单例,您可以向其中添加一个更新适当图像的选择器。但它仍然很混乱。有什么想法吗?
I have a table with images that are loaded from the web. I'd like to have an animated loading screen while it's loading.
I tried (successfully) to use a UIImageView
and use the animation property. I want the loading animation to be synced however. What would be the cleanest way to do this?
I tried to use NSTimer
. I would use NSDate
to get miliseconds = m. Then (m * 500) % 4 to get 4 frames per 2 seconds. I wasn't able to get it to work. I also feel it's a bit messy to have 10 to 20 timers going on at the same time. One thing I was thinking is to have a singleton that has a NSMutableArray
to which you can add a selector that updates the appropriate image. But it's still quite messy. Any ideas?
发布评论
评论(1)
我建议您查看 MBProgressHUD:
更多信息:
http://macindie.com/2011/01/mbprogresshud-when-you-simply-have-to-make-users-wait/
I suggest you check out MBProgressHUD:
More info:
http://macindie.com/2011/01/mbprogresshud-when-you-simply-have-to-make-users-wait/