Created
April 8, 2013 21:51
-
-
Save jinqian/5340858 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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