Guest User

Untitled

a guest
May 21st, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. class TestClass {
  2. @objc static func testFunction() {
  3. print("testFunction")
  4. }
  5. }
  6.  
  7. // MARK: - Назначаете:
  8.  
  9. yourButton.addTarget(TestClass.self, action: #selector(TestClass.testFunction), for: .touchUpInside)
  10.  
  11. class CustomButton: UIButton {
  12. override func awakeFromNib() {
  13. super.awakeFromNib()
  14. addTarget(self, action: #selector(buttonAction), for: .touchUpInside)
  15. }
  16.  
  17. @objc func buttonAction() {
  18. print("Test")
  19. }
  20. }
Add Comment
Please, Sign In to add comment