【发布时间】:2017-10-27 14:51:42
【问题描述】:
我创建了自定义 UIRefreshControl 如下:
class CustRefreshCont: UIRefreshControl {
override func draw(_ rect: CGRect) {
// Drawing code
let blueColor: UIColor = UIColor.blue
let lightGrayColor: UIColor = UIColor.lightGray
self.tintColor = blueColor
self.backgroundColor = lightGrayColor
self.attributedTitle = NSAttributedString(string: "Updating data", attributes: [NSAttributedStringKey.foregroundColor : self.tintColor, NSAttributedStringKey.backgroundColor : self.backgroundColor!])
}
}
我从 UIViewController 分配 UIRefreshControl 的方式复制如下:
let refreshControl = CustRefreshCont()
正在显示文本和 ActivityIndicator 自定义项,但背景颜色显示为黑色。
你知道我的代码有什么问题吗?
【问题讨论】:
-
所以 tintColor 和 backgroundColor 没有正确显示对吗?
-
tintColor 显示正确。只是视图的背景颜色。
标签: ios swift uirefreshcontrol