我正在写执行与AFNetworking框架HTTP请求的应用程序,数据收到得到解析,然后放入表视图活动指示器的动画仅一次
我已经创建与装载机特殊细胞,这表明当请求正在处理中。这个单元格只有一个.xib文件,没有自定义类。 我在此单元格内添加了活动指示器,并在属性检查器中选中了“动画”选项。
而且我已经创建BOOL伊娃显示该单元格。
BOOL isLoading;
这里是进行时“搜索”功能按钮,点击:
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
if ([searchBar.text length] > 0){
isLoading = YES;
[self.tableView reloadData];
searchResults = [NSMutableArray arrayWithCapacity:10];
NSURL *url = [self urlWithSearchText:searchBar.text];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFJSONRequestOperation *operation = [AFJSONRequestOperation
JSONRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
[self parseDictionary:JSON];
[searchResults sortUsingSelector:@selector(compareName:)];
isLoading = NO;
[self.tableView reloadData];
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON){
[self showNetworkError];
isLoading = NO;
[self.tableView reloadData];
}];
[queue addOperation:operation];
}
}
这里就是我如何得到该小区
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (isLoading) {
return [tableView dequeueReusableCellWithIdentifier:LoadingCellIdentifier];
}
/*other code */
}
当我执行我的第一次搜索该小区出现用动画活动指示器和一切正常,但所有其他时间这个单元格出现指示器不旋转,这就是问题。为什么会这样呢?我如何让它旋转所有其他时间?
应用http://monosnap.com/image/TRFK4cXEvYK2VPpteE1j5x0eB.png
哪里是你的起点和停止activiindicator代码? – Rajneesh071 2013-03-15 17:30:25
@ Rajneesh071我有没有代码,因为我选择的行为:在属性检查器中为活动指示灯动画,所以必须动画所有的时间在任何条件下 – Dudeson 2013-03-20 10:30:40
发送您的示例代码... – Rajneesh071 2013-03-20 11:29:28