Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ViewController: UIViewController {

// star button
let starButton = DOFavoriteButton(frame: CGRectMake(x, y, 44, 44), image: UIImage(named: "star"))
starButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
starButton.addTarget(self, action: #selector(ViewController.tappedButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(starButton)
x += width

Expand All @@ -31,7 +31,7 @@ class ViewController: UIViewController {
heartButton.imageColorOn = UIColor(red: 254/255, green: 110/255, blue: 111/255, alpha: 1.0)
heartButton.circleColor = UIColor(red: 254/255, green: 110/255, blue: 111/255, alpha: 1.0)
heartButton.lineColor = UIColor(red: 226/255, green: 96/255, blue: 96/255, alpha: 1.0)
heartButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
heartButton.addTarget(self, action: #selector(ViewController.tappedButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(heartButton)
x += width

Expand All @@ -40,7 +40,7 @@ class ViewController: UIViewController {
likeButton.imageColorOn = UIColor(red: 52/255, green: 152/255, blue: 219/255, alpha: 1.0)
likeButton.circleColor = UIColor(red: 52/255, green: 152/255, blue: 219/255, alpha: 1.0)
likeButton.lineColor = UIColor(red: 41/255, green: 128/255, blue: 185/255, alpha: 1.0)
likeButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
likeButton.addTarget(self, action: #selector(ViewController.tappedButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(likeButton)
x += width

Expand All @@ -49,10 +49,10 @@ class ViewController: UIViewController {
smileButton.imageColorOn = UIColor(red: 45/255, green: 204/255, blue: 112/255, alpha: 1.0)
smileButton.circleColor = UIColor(red: 45/255, green: 204/255, blue: 112/255, alpha: 1.0)
smileButton.lineColor = UIColor(red: 45/255, green: 195/255, blue: 106/255, alpha: 1.0)
smileButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
smileButton.addTarget(self, action: #selector(ViewController.tappedButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(smileButton)

self.heartButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
self.heartButton.addTarget(self, action: #selector(ViewController.tappedButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
}

override func didReceiveMemoryWarning() {
Expand Down
10 changes: 5 additions & 5 deletions DOFavoriteButton/DOFavoriteButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@ public class DOFavoriteButton: UIButton {
//===============
// add target
//===============
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)
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)
}

func touchDown(sender: DOFavoriteButton) {
Expand Down