Revision 54fd5c36 Classes/ContainerDetailViewController.m

b/Classes/ContainerDetailViewController.m
674 674
    [super dealloc];
675 675
}
676 676

  
677
#pragma mark -
678
#pragma mark Helper functions
679

  
680
- (void)reloadMetadataSection {
681
    NSString *activityMessage = @"Loading metadata...";
682
    activityIndicatorView = [[ActivityIndicatorView alloc] initWithFrame:[ActivityIndicatorView frameForText:activityMessage] text:activityMessage];
683
    [activityIndicatorView addToView:self.view scrollOffset:self.tableView.contentOffset.y]; 
684
    [[self.account.manager getContainerInfo:container] 
685
     success:^(OpenStackRequest *request) {
686
         [activityIndicatorView removeFromSuperviewAndRelease];
687
         container.metadata = [NSMutableDictionary dictionary];
688
         for (NSString *header in request.responseHeaders) {
689
             NSString *metadataKey;
690
             NSString *metadataValue;
691
             if ([header rangeOfString:@"X-Container-Meta-"].location != NSNotFound) {
692
                 metadataKey = [header substringFromIndex:17];
693
                 metadataValue = [request.responseHeaders objectForKey:header];
694
                 [container.metadata setObject:metadataValue forKey:metadataKey];
695
             }
696
         } 
697
         NSIndexSet *metadataSections = [NSIndexSet indexSetWithIndex:kMetadata];
698
         [self.tableView reloadSections:metadataSections withRowAnimation:UITableViewRowAnimationFade];
699
     }
700
     failure:^(OpenStackRequest *request) {
701
         [activityIndicatorView removeFromSuperviewAndRelease];
702
         [self alert:@"There was a problem retrieving the container's metadata." request:request]; 
703
     }];
704
}
705

  
677 706
@end
678 707

  

Also available in: Unified diff