3
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
@interface KBFunctionTagCell ()
|
||||
@property (nonatomic, strong) UILabel *titleLabelInternal;
|
||||
@property (nonatomic, strong) UIImageView *iconViewInternal;
|
||||
@property (nonatomic, strong) UIActivityIndicatorView *loadingView;
|
||||
@end
|
||||
|
||||
@implementation KBFunctionTagCell
|
||||
@@ -34,6 +35,14 @@
|
||||
make.right.equalTo(self.contentView.mas_right).offset(-10);
|
||||
make.centerY.equalTo(self.contentView.mas_centerY);
|
||||
}];
|
||||
|
||||
// 小菊花:默认隐藏,放在标题右侧
|
||||
[self.contentView addSubview:self.loadingView];
|
||||
[self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.contentView);
|
||||
make.right.equalTo(self.contentView.mas_right).offset(-10);
|
||||
make.width.height.mas_equalTo(16);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -64,10 +73,35 @@
|
||||
return _titleLabelInternal;
|
||||
}
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
||||
static UIActivityIndicatorViewStyle KBSpinnerStyle(void) { return UIActivityIndicatorViewStyleMedium; }
|
||||
#else
|
||||
static UIActivityIndicatorViewStyle KBSpinnerStyle(void) { return UIActivityIndicatorViewStyleGray; }
|
||||
#endif
|
||||
|
||||
- (UIActivityIndicatorView *)loadingView {
|
||||
if (!_loadingView) {
|
||||
_loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:KBSpinnerStyle()];
|
||||
_loadingView.hidesWhenStopped = YES;
|
||||
_loadingView.color = [UIColor grayColor];
|
||||
_loadingView.hidden = YES;
|
||||
}
|
||||
return _loadingView;
|
||||
}
|
||||
|
||||
#pragma mark - Expose
|
||||
|
||||
- (UILabel *)titleLabel { return self.titleLabelInternal; }
|
||||
- (UIImageView *)iconView { return self.iconViewInternal; }
|
||||
|
||||
@end
|
||||
- (void)setLoading:(BOOL)loading {
|
||||
if (loading) {
|
||||
self.loadingView.hidden = NO;
|
||||
[self.loadingView startAnimating];
|
||||
} else {
|
||||
[self.loadingView stopAnimating];
|
||||
self.loadingView.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user