xcode UIRefreshControl 改变 UIActivityIndicatorView 的颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14642484/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
UIRefreshControl change color of UIActivityIndicatorView
提问by user1053839
There is any way to change the color of the "UIActivityIndicatorView" of the UIRefreshControl??
有什么办法可以改变UIRefreshControl的“UIActivityIndicatorView”的颜色??
I didn't find anything!
我什么都没找到!
Thanks!!
谢谢!!


回答by subharb
You can do it by setting the Tint Colorof the UIRefreshControl, something like this:
您可以通过设置做到这一点Tint Color的UIRefreshControl,是这样的:
Objective C[refreshControl setTintColor:[UIColor blackColor]];
目标C[refreshControl setTintColor:[UIColor blackColor]];
SwiftrefreshControl.tintColor = .black
迅速refreshControl.tintColor = .black
This will also change the arrow that expands when you slide.
这也将更改滑动时展开的箭头。
回答by Rosalie W
As the previous answer is outdated, I thought that I would just modify it to Swift 4 and share the solution (credit goes to @subharb).
由于之前的答案已过时,我认为我只需将其修改为 Swift 4 并分享解决方案(归功于 @subharb)。
refreshControl.tintColor = UIColor.white
This line of code will change the color of the UIActivityIndicatorView to whatever color you want it to be :)
这行代码会将 UIActivityIndicatorView 的颜色更改为您想要的任何颜色:)

![为什么 Xcode 使用 NSStringFromClass([AppDelegate class]) 而不是 @](/res/img/loading.gif)