Created
March 23, 2016 00:24
-
-
Save jasdev/3338cda9d6c799323abe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class SampleViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let button = UIButton(type: .System) | |
// ... | |
button.addTarget(self, action: #selector(SampleViewController.buttonTapped(_:)), forControlEvents: .TouchUpInside) | |
view.addSubview(button) | |
} | |
/** | |
Handle .TouchUpInside event on the button in SampleViewController. | |
This is a method associated with an action selector, not meant to be called externally. | |
- parameter button: The button that was tapped | |
*/ | |
func buttonTapped(button: UIButton) { | |
print("Selector method called!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment