Skip to content

Instantly share code, notes, and snippets.

@jinqian
Created April 8, 2013 21:51
Show Gist options
  • Save jinqian/5340858 to your computer and use it in GitHub Desktop.
Save jinqian/5340858 to your computer and use it in GitHub Desktop.
@implementation UITableViewCell (ProgressIndicator)
- (void)showProgress:(BOOL)show {
if(show) {
UIActivityIndicatorView *progress = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
UIView *progressView = [[UIView alloc] initWithFrame:CGRectMake(0,0,20,20)];
[progressView addSubview: progress];
if(self.accessoryView) {
progressView.frame = self.accessoryView.bounds;
}
progress.center = progressView.center;
[progress startAnimating];
self.accessoryView = progressView;
if(self.detailTextLabel.textAlignment == UITextAlignmentRight)
self.detailTextLabel.text = @"";
[progress release];
[progressView release];
} else {
self.accessoryView = nil;
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment