I am using a UIRefreshControl in my UITableViewController to refresh the content. I use the following code in my -viewDidLoad
method to add it to my table.
UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
//[refresh setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Reloading" attributes:@{NSForegroundColorAttributeName : [UIColor lightGrayColor]}]];
[refresh setTintAdjustmentMode:UIViewTintAdjustmentModeNormal];
[refresh setTintColor:[UIColor colorFromHex:0xff8900]];
[refresh addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
[[refresh layer] setZPosition:-1.0f];
//if (iOS_AT_LEAST(10)) {
// [self setRefreshControl:refresh];
//} else {
[self setRefresher:refresh];
[[self tableView] insertSubview:[self refresher] atIndex:0];
//}
I created a category for UIColor so it can accept hex values. I use this in the complete application and on another location I get #ff8900
back which is correct. But setting the tint color on the UIRefreshControl gives me #fb6a2e
which is odd. The same happens when I try a default color, for example [UIColor lightGrayColor] gives me another tint than giving the same color to another view.
I have found the following post: UIRefreshControl tint color doesn't match given color. I tried to put it into an animation block and the hack given in the answer, but with no luck.
What do I do wrong here?
Another side question. When setting the attributed title, the spinner has a greater space from the top. If this happens, the title will be below the cell if only one is available. Is there a way to move the string up?