【发布时间】:2014-03-07 08:53:04
【问题描述】:
如何使用此方法在占位符中执行活动指示器?
- (void)createActivityIndicatorWithStyle:(UIActivityIndicatorViewStyle) activityStyle {
if ([self activityIndicator] == nil) {
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:activityStyle];
self.activityIndicator.autoresizingMask = UIViewAutoresizingNone;
//calculate the correct position
float width = self.activityIndicator.frame.size.width;
float height = self.activityIndicator.frame.size.height;
float x = (self.frame.size.width / 2.0) - width/2;
float y = (self.frame.size.height / 2.0) - height/2;
self.activityIndicator.frame = CGRectMake(x, y, width, height);
self.activityIndicator.hidesWhenStopped = YES;
[self addSubview:self.activityIndicator];
}
[self.activityIndicator startAnimating];
}
感谢任何帮助
【问题讨论】:
-
你把指标放在哪里?是 UIImageView 吗?
-
是的,我需要这样做并将指示器放在 UIImageView 占位符中
-
需要修改SDWebImage的开源,可以接受吗?
-
是的,我接受,你能帮忙吗?
标签: iphone xcode ios7 sdwebimage