【发布时间】:2015-09-09 11:09:15
【问题描述】:
我想快速将颜色数组传递给 drawRect,我该怎么做? (我遇到了很多错误..)
class GradientColorView : UIView {
static let colors : NSArray = NSArray()
override init(frame: CGRect) {
super.init(frame: frame)
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
class func initWithColors(colors :NSArray) {
}
override func drawRect(rect: CGRect) {
println(self.colors)
println("drawRect has updated the view")
}
}
【问题讨论】: