Open kiwo12345 opened 8 years ago
Okey I got it working now.. If anyone is using Swift 2.2 change addTargets() to:
private func addTargets() {
//===============
// add target
//===============
self.addTarget(self, action: #selector(DOFavoriteButton.touchDown(_:)), forControlEvents: UIControlEvents.TouchDown)
self.addTarget(self, action: #selector(DOFavoriteButton.touchUpInside(_:)), forControlEvents: UIControlEvents.TouchUpInside)
self.addTarget(self, action: #selector(DOFavoriteButton.touchDragExit(_:)), forControlEvents: UIControlEvents.TouchDragExit)
self.addTarget(self, action: #selector(DOFavoriteButton.touchDragEnter(_:)), forControlEvents: UIControlEvents.TouchDragEnter)
self.addTarget(self, action: #selector(DOFavoriteButton.touchCancel(_:)), forControlEvents: UIControlEvents.TouchCancel)
}
then change select() to
public func select() {
select(animate: true)
}
There is a pull request to fix this code.. will it be merged?
Waiting on this merge to implement
+1
Doing a Carthage build doesn't work either - most likely because of this same issue. Waiting to be able to use this framework!
@kiwo12345 I can't add animate:true to the select, and getting "[DOFavoriteButton.DOFavoriteButton select:]: unrecognized selector sent to instance "
I get a few warnings saying that the selectors need to change form: self.addTarget(self, action: "touchDown:", forControlEvents: UIControlEvents.TouchDown) self.addTarget(self, action: "touchUpInside:", forControlEvents: UIControlEvents.TouchUpInside) self.addTarget(self, action: "touchDragExit:", forControlEvents: UIControlEvents.TouchDragExit) self.addTarget(self, action: "touchDragEnter:", forControlEvents: UIControlEvents.TouchDragEnter) self.addTarget(self, action: "touchCancel:", forControlEvents: UIControlEvents.TouchCancel) to:
self.addTarget(self, action: #selector(DOFavoriteButton.touchDown(:)), forControlEvents: UIControlEvents.TouchDown) self.addTarget(self, action: #selector(DOFavoriteButton.touchUpInside(:)), forControlEvents: UIControlEvents.TouchUpInside) self.addTarget(self, action: #selector(DOFavoriteButton.touchDragExit(:)), forControlEvents: UIControlEvents.TouchDragExit) self.addTarget(self, action: #selector(DOFavoriteButton.touchDragEnter(:)), forControlEvents: UIControlEvents.TouchDragEnter) self.addTarget(self, action: #selector(DOFavoriteButton.touchCancel(_:)), forControlEvents: UIControlEvents.TouchCancel)
But updating the selectors will result in my app crashing giving me the error: libc++abi.dylib: terminating with uncaught exception of type NSException
[Test.DOFavoriteButton select:]: unrecognized selector sent to instance 0x7fea9ad6f480 2016-03-29 23:07:17.286 Test[16889:2397051] *\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Test.DOFavoriteButton select:]: unrecognized selector sent to instance 0x7fea9ad6f480'