ios – UIRefreshControl色调颜色与给定颜色不匹配

刷新颜色与色调颜色不匹配,看起来不同,我试图更改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]}];

解决方法

UIRefreshControl是一个错误的类.我注意到放置了tvc.refreshControl.tintColor = [UIColor colorWithHex:0x2C76BE];在动画块内(即使是零持续时间)也会产生预期的结果.所以我测试了这个可怕的’hack’:dispatch_async(mainQueue,< #set tintColor#>);这也给出了正确的结果.可能还存在refreshcontrol对调用-beginRefreshing或-endRefreshing的时间的依赖性.

因为UIRefreshControl的错误以及只能在UITableViewController中使用的限制让我非常恼火,所以我创建了一个完全可自定义的,可用于任何类型的UIScrollView(UICollectionView,UITableView).请注意,我在UICollectionViewFlowLayout支持像tableView这样的粘性标头之前创建了这个,所以当启用该选项时,我的refreshcontrol不能正常工作.随意提交修复;).

你可以在这里找到https://github.com/Joride/JRTRefreshControl(如果这属于’无耻的插入条款’我会删除这个链接,但我认为它与问题有关.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...