2011-11-22 160 views
4

我看到一次图书馆可以很好地做UIActivityIndicatorView,但我找不到它。有人知道或知道另一种方式来制作漂亮的UIActivityIndicatorView?像这样的东西 http://hpics.li/64d7b07做漂亮的UIActivityIndi​​catorView

+0

你是什么意思'好'?你能具体吗? ?! – Legolas

+0

@Legolas我添加了一个例子 – Keviin55

回答

10

退房MBProgressHUD

我觉得跟细节标签活动的指标就是你究竟在寻找。

+0

这就是我一直在寻找的!谢谢 – Keviin55

1

我从来没有听说过这样的库,但它不应该太难创建自己的(作为一个嵌入式UIView)和动画。

甚至可能是一个动画gif? (related question linked here

+0

不,但它可以帮助我,tahnk你 – Keviin55

16

我今天刚做了类似的事情。我将把它变成一个适当的子类,但现在,这应该让你开始。添加一个UILabel应该很容易。我正在用ARC做这个,所以如果你需要做内存管理,请小心。

UIView *activityContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 
activityContainer.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:.25]; 
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake((self.view.frame.size.width/2) - 40, (self.view.frame.size.height/2) - 40, 80, 80)]; 
indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; 
indicator.backgroundColor = [UIColor blackColor]; 
[indicator layer].cornerRadius = 8.0; 
[indicator layer].masksToBounds = YES; 
[activityContainer addSubview:indicator]; 
+0

它很简单,它的工作原理,谢谢。 –

相关问题