如何使用图像代替活动指示器?
在我的应用程序中,当我单击刷新按钮时,会出现一个活动指示器。当 tableView 刷新时,它就会消失。我想使用图像而不是活动指示器,这样当我单击刷新时,该图像会出现在整个屏幕上,当视图 ll b 刷新时,它会消失。我怎样才能做到这一点?提前致谢
in my app when i click on refresh button, an activity indicator appears. and when tableView is refreshed then it disappears. i want to use a image instead of that activity indicator in such a way that when i click on refresh that image ll come on the whole screen and when view ll b refreshed it ll disappear. how can i do that? thanx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基本上,您需要做的是在当前视图上添加一个“封面”视图。
如果将 alpha 设置为 50% 左右,这些通常效果最佳。
点击按钮,您可以调用
addSubview:coverPage
,在其中使用正确的属性初始化 coverPage。如果需要,封面可以有自己的旋转器或标签。
刷新完成后,只需调用
[coverPage removeFromSuperview]
即可关闭。Basically what you need to do is add a "cover page" view over your current view.
These usually work best if you set the alpha to about 50%.
Hitting the button you can call
addSubview:coverPage
where you init coverPage somewhere with the right attributes.If you want, cover page can have it's own spinners or labels if necessary.
after your refresh completes, just call
[coverPage removeFromSuperview]
to dismiss.UIActivityIndicatorView
是一个旋转的东西,它是默认的忙碌指示器。它继承自UIView。如果您对其进行子类化并拥有自己的drawRect:
实现,您应该能够绘制任何您喜欢的图像来代替旋转条。UIActivityIndicatorView
is the spinning thing that is the default busy indicator. It inherits from UIView. If you subclass it and have your owndrawRect:
implementation you should be able to draw any image you like in place of the spinning bars.