我正在使用 ASIHTTPRequest 加载 JSON 数据。当用户触摸按钮时,我请求大量数据(这里我正在加载另一个将请求 JSON 数据的 View )。大约需要 15 秒。加载。一旦用户触摸按钮直到数据加载,我如何使用 UIActivityIndicatiorView 。
有人以前这样做过或者有任何提高用户性能的建议吗?
最佳答案
-(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加载数据时如何使用UIActivityIndicatorView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10091991/