ios 自定义颜色我的 UIActivityIndicatorView
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2805200/
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
Custom color my UIActivityIndicatorView
提问by lavoy
I would like to have my UIActivityIndicatorView
be colored a custom color. Is there any way to set this property?
我想让我的UIActivityIndicatorView
颜色变成自定义颜色。有没有办法设置这个属性?
回答by Roland Keesom
In iOS 5.0 and up you can use setColor:
on the UIActivityIndicatorView
to set a custom color.
在 iOS 5.0 及更高版本中,您可以使用setColor:
onUIActivityIndicatorView
来设置自定义颜色。
In Swift you can just use activityIndicatorView.color = UIColor.red
在 Swift 中你可以使用 activityIndicatorView.color = UIColor.red
回答by kennytm
You need to create a custom set of images (better), then animate it using a UIImageView.
您需要创建一组自定义图像(更好),然后使用 UIImageView 为其设置动画。
Or place a colored transparent view on top of the activity indicator to "tint" it (lower quality).
或者在活动指示器顶部放置一个彩色透明视图以“着色”它(较低质量)。
回答by Murray Sagal
For Xcode 7 (possibly earlier) you can also specify the color directly in Interface Builder.
对于 Xcode 7(可能更早),您还可以直接在 Interface Builder 中指定颜色。
回答by Stavash
Here is another good option for you:
这是您的另一个不错的选择:
http://cocoacontrols.com/platforms/ios/controls/hzactivityindicatorview
http://cocoacontrols.com/platforms/ios/controls/hzactivityindicatorview
回答by crizzwald
I created a custom UIView (Loader Animation) to which you could load into a subclass of UIActivity
.
我创建了一个自定义 UIView(加载器动画),您可以将其加载到UIActivity
.