如何在iPhone应用程序导航时实现加载动画? [英] How to implement a loading animation when navigating in a iPhone app?
问题描述
这似乎是一个pretty简单的问题,但我一直无法找到任何很好的答案。
It seems like a pretty simple problem, but I have been unable to find any good answers.
我想要做的是使一些动画,而一些功能加载。我已经包含在等待内容时webapp的一个动画的.gif文件,但在本土航行时,我需要相同的功能。例如,当我preSS在标签栏按钮,直到整个页面加载屏幕只是空白。
What I'm trying to do is to make some sort of animation while some function is loading. I have already included an animated .gif file in the webapp when waiting for content, but I need the same functionality when navigating in native. For instance, when I press a button in the tab bar, the screen is just blank until the entire page is loaded.
它并不需要是任何幻想。我想这与臭名昭著的纺车比如Facebook的应用程序解决的方式。
It doesn't need to be anything fancy. I like the way this is solved in the facebook app with the infamous "spinning wheel" for instance.
在此先感谢!
推荐答案
可以作为一个子视图添加一个UIActivityIndicatorView到一个视图,当动作结束时,你可以从上海华...
you can add an UIActivityIndicatorView as a subview to a view and when the action is over you can remove it from superview...
UIActivityIndicatorView *av = [[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease];
av.frame=CGRectMake(145, 160, 25, 25);
av.tag = 1;
[yourView addSubview:av];
[av startAnimating];
删除它
UIActivityIndicatorView *tmpimg = (UIActivityIndicatorView *)[yourView viewWithTag:1];
[tmpimg removeFromSuperview];
希望它可以帮助...
hope it helps...
这篇关于如何在iPhone应用程序导航时实现加载动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!