微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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(如果这属于’无耻的插入条款’我会删除这个链接,但我认为它与问题有关.

原文地址:https://www.jb51.cc/iOS/331629.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐