如何更改加载图标的颜色

时间:2013-02-13 15:51:06

标签: ios xcode refresh

我想改变拉动刷新后出现的加载图标的颜色这是我的指示器样式的代码我认为这与我想做的事情有关但我没有编写代码,它来自:{{3 }}

-(void)setActivityIndicatorViewStyle:  (UIActivityIndicatorViewStyle)activityIndicatorViewStyle
{
if ([_activity isKindOfClass:[UIActivityIndicatorView class]]) {
    [(UIActivityIndicatorView *)_activity setActivityIndicatorViewStyle:activityIndicatorViewStyle];
}
}

- (UIActivityIndicatorViewStyle)activityIndicatorViewStyle
{
if ([_activity isKindOfClass:[UIActivityIndicatorView class]]) {
    return [(UIActivityIndicatorView *)_activity activityIndicatorViewStyle];
}
return 0;
}

- (void)setActivityIndicatorViewColor:(UIColor *)activityIndicatorViewColor
{
if ([_activity isKindOfClass:[UIActivityIndicatorView class]] && [_activity respondsToSelector:@selector(setColor:)]) {
    [(UIActivityIndicatorView *)_activity setColor:activityIndicatorViewColor];
}
}


- (UIColor *)activityIndicatorViewColor
{
if ([_activity isKindOfClass:[UIActivityIndicatorView class]] && [_activity respondsToSelector:@selector(color)]) {
    return [(UIActivityIndicatorView *)_activity color];
}
return nil;
}

1 个答案:

答案 0 :(得分:1)

在文件ODRefreshControl.m中,更改

中的以下行
- (id)initInScrollView:(UIScrollView *)scrollView activityIndicatorView:(UIView *)activity

_activity = activity ? activity : [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

_activity = activity ? activity : [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];