Stackoverflowers!
Once again, I come to the hive mind for assistance. This time it's a very peculiar issue and, unfortunately, I cannot get my head around it.
The issue's related to the pull down to refresh mechanism with a UIRefreshControl. The pull down itself works fine when it's initiated by a - pull down. When I want to trigger the loading manually, it works fine also, but with one blocking issue - the colour of the activity indicator does not change to the tint colour it was set to.
-viewDidLoad
_publicationsRefreshControl = [[UIRefreshControl alloc] init];
NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:NSLocalizedString(localizationRefreshControlTitle, nil) attributes:@{NSFontAttributeName : [UIFont fontWithName:fontLatoRegular size:14], NSForegroundColorAttributeName : [UIColor whiteColor]}];
_publicationsRefreshControl.attributedTitle = attributedTitle;
_publicationsRefreshControl.tintColor = [UIColor whiteColor];
[_publicationsRefreshControl addTarget:self action:@selector(refreshPublications:) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:_publicationsRefreshControl];
This properly initialises the UIRefreshControl and it indeed does work when you pull down the CollectionView.
When I use the following method :
- (void)action {
[_publicationsRefreshControl beginRefreshing];
[_collectionView setContentOffset:CGPointMake(0, _collectionView.contentOffset.y - _publicationsRefreshControl.frame.size.height) animated:YES];
[_publicationsRefreshControl sendActionsForControlEvents:UIControlEventValueChanged]; }
to manually start the refresh, the colour of the activity indicator does not change to white. It stays at the default colour. I've tried setting the tintColor property in the action method, at all possible placement combinations, to no avail.
The interesting thing is that, if I pull down the collection view and start the refresh first, then try to manually start the refresh, it will be properly coloured white. The colour issue shows up only if I try to refresh manually first.
Other options I've tried :
- Tried to invoke tintColorDidChange
- Tried to manually change the Style of the underlying ActivityIndicatorView
I appreciate any help anyone's willing to offer :)