iphone - 如何在我的应用程序委托(delegate)中使用 UIActivityViewIndicator?

标签 iphone objective-c cocoa-touch ios5 uiactivityindicatorview

我的应用程序委托(delegate)中有一个方法,调用该方法可以从 Web 服务器提取信息。有没有一种方法可以轻松地将 UIActivityViewIndicators 合并到应用程序委托(delegate)中?到目前为止我在网上发现的所有内容都显示需要添加为 subview 的指标。这可行吗?如果是这样,您能给我指出在哪里可以找到这个的正确方向吗?

[编辑] 我使用 Storyboard而不是 xib。

最佳答案

您可以使用几行代码轻松添加 UIActivityViewIndicators:

UIActivityIndicatorView *aiv = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease];  
aiv.center = self.window.rootViewController.view.center;
[self.window.rootViewController.view addSubview:aiv];
[aiv startAnimating]; 

但是有很多开源项目,例如 MBProgressHUD这为您提供了更时尚的指示器以及其他附加功能..

关于iphone - 如何在我的应用程序委托(delegate)中使用 UIActivityViewIndicator?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11870155/

相关文章:

iphone - 我可以在Windows上运行Objective C应用程序吗?

iphone - 如何存储多个坐标和 map 套件绘图路线

iphone - UITableViewCell 重用良好实践

iphone - 使用方向调整多个 ImageView 的大小

ios - 如何在 View Controller 上获取导航栏?

ios - AVAssetWriterInput 当前不支持 AVVideoScalingModeFit - IOS 错误

ios - 什么时候应该使用 UIImageJPEGRepresentation 和 UIImagePNGRepresentation 将不同的图像格式上传到服务器?

iphone - 如何解决Instruments检测到的泄漏,其责任库是Apple的框架?

ios - 如何在 iOS 中通过 HTTP 请求上传多张图片?

ios - 如何等到异步调用完成,包括完成 block (AFNetworking)