UIRefreshControl色调与给定颜色不匹配

Pet*_*isu 9 cocoa-touch uitableview ios uirefreshcontrol ios9

刷新颜色与色调颜色不匹配,看起来不同,我试图更改tintAdjustmentMode,但结果是一样的

需要注意的是,微调器和文本颜色应为0x2C76BE

tvc.refreshControl = [UIRefreshControl new];
tvc.refreshControl.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
tvc.refreshControl.tintColor = [UIColor colorWithHex:0x2C76BE];
tvc.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to query spectrum again" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:0x2C76BE]}];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Jor*_*ide 0

UIRefreshControl 是一个有缺陷的类。我注意到将其放置tvc.refreshControl.tintColor = [UIColor colorWithHex:0x2C76BE];在动画块内(即使是零持续时间)会产生预期的结果。所以我测试了这个可怕的“黑客”:dispatch_async(mainQueue, <#set tintColor#>);并且也给出了正确的结果。-beginRefreshing刷新控制也可能依赖于调用的时间-endRefreshing

因为我对 UIRefreshControl 的错误和只能在 UITableViewController 中使用的限制感到非常恼火,所以我创建了一个完全可定制的自己的控件,可与任何类型的 UIScrollView(UICollectionView、UITableView)一起使用。请注意,我在 UICollectionViewFlowLayout 支持像 tableView 这样的粘性标题之前创建了此控件,因此当该选项打开时,我的刷新控件无法正常工作。请随意提交修复程序;)。

您可以在这里找到它https://github.com/Joride/JRTRefreshControl(如果这属于“无耻插入条款”,我将删除此链接,但我认为它与问题相关。