0
이 클래스를 찾을 수없는 이유는 알 수 없습니다. 나는이 비슷한 다른 게시물을 보았지만, 나의 대표자의 나의 명명 규칙은 신속하게 방해해서는 안된다. 내가 생각할 수있는 모든 것을 시도했지만 SelectButton을 찾을 수없는 이유는 아직 모른다.선언되지 않은 유형의 사용
아이디어가 있으십니까? 내가 작업 한의 repo에서 가져온
은import UIKit
import QuartzCore
protocol SelectButtonDelegate {
func willSelectButton(button: SelectButton)
}
class SelectButton: UIButton {
var delegate: SelectButtonDelegate?
let normalColor = UIColor(white: 0, alpha: 0.2)
let selectedColor = UIColor(white: 0, alpha: 0.4)
let recessedColor = UIColor(white: 0, alpha: 0.5)
init(frame: CGRect, title: String) {
super.init(frame: frame)
backgroundColor = normalColor
setTitle(title, forState: .Normal)
setTitleColor(UIColor(white: 1, alpha: 0.2), forState: .Normal)
setTitleColor(UIColor(white: 1, alpha: 0.7), forState: .Selected)
layer.cornerRadius = 3
bk_addEventHandler({ (object) -> Void in
UIView.animateWithDuration(0.1, animations: {() -> Void in
self.backgroundColor = self.recessedColor
})
}, forControlEvents: .TouchDown)
bk_addEventHandler({ (object) -> Void in
UIView.animateWithDuration(0.1, animations: {() -> Void in
self.backgroundColor = self.currentColor()
})
}, forControlEvents: .TouchUpOutside)
bk_addEventHandler({ (object) -> Void in
UIView.animateWithDuration(0.1, animations: {() -> Void in
self.switchState()
self.backgroundColor = self.currentColor()
})
}, forControlEvents: .TouchUpInside)
}
func currentColor() -> UIColor {
if selected == true {
return selectedColor
}
return normalColor
}
func switchState() {
if selected == true {
selected = false
}
else {
if delegate != nil {
delegate!.willSelectButton(self)
}
selected = true
}
}
func deselect() {
selected = false
UIView.animateWithDuration(0.1, animations: {() -> Void in
self.backgroundColor = self.currentColor()
})
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
찾을 수없는 소스 파일에 올바르게 가져 왔습니까? –
유일한 오류입니까? 실제로 텍스트가 표시된 파일이 컴파일됩니까? 그것은 당신의 표적의 일부입니까? – matt
나는 어떤 것도 가져올 필요가 없기 때문에 swift를 사용하고있다. –