how to change colour of loading icon

2019-09-03 09:42发布

I want to change the colour of the loading icon that comes up after pulling to refresh this is my code for the indicatorviewstyle i think this is related to doing what i want but i didnt write the code, its from: https://github.com/Sephiroth87/ODRefreshControl

-(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条回答
够拽才男人
2楼-- · 2019-09-03 10:11

In the file ODRefreshControl.m , change the following line in

- (id)initInScrollView:(UIScrollView *)scrollView activityIndicatorView:(UIView *)activity

from

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

to

_activity = activity ? activity : [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
查看更多
登录 后发表回答