ios - ASIHTTPRequest加载数据时如何使用UIActivityIndi​​catorView?

标签 ios uiactivityindicatorview

我正在使用 ASIHTTPRequest 加载 JSON 数据。当用户触摸按钮时,我请求大量数据(这里我正在加载另一个将请求 JSON 数据的 View )。大约需要 15 秒。加载。一旦用户触摸按钮直到数据加载,我如何使用 UIActivityIndi​​catiorView 。

有人以前这样做过或者有任何提高用户性能的建议吗?

最佳答案

    -(void) startRequest:(NSString*)username password:(NSString*)password
{
   ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:mainUrl];    
    [request setDelegate:self]; 
    [request setDidFailSelector:@selector(requestFailed:)];
    [request startAsynchronous];
    [self.addSubview:self.indicator];
    [indicator startAnimating];

}

    -(void) requestFinished: (ASIHTTPRequest *) request {

    [self.indicator stopAnimating];
    [self.indicator removeFromSuperview];

}

关于ios - ASIHTTPRequest加载数据时如何使用UIActivityIndi​​catorView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10091991/

相关文章:

swift - 在 Swift 2.0 的 UITableView 中动态移动事件指示器

ios - 调用网络服务时显示 UIActivityIndi​​cator

ios - 如何在 Interface Builder 中使用自定义 UIButton?

ios - 为什么通用应用程序的ipa是300mb?

ios - 重新加载 UITableView 的内容

ios - 无法在 API 调用结束时隐藏事件指示器

ios - 带循环的事件指示器

ios - UIActivityIndi​​catorView 不显示/开始动画

ios - 将双引号添加到 NSString 附加到变量

ios - UITextView - 在 XCode 5 上设置字体不适用于 iOS 6