Last active
October 16, 2015 20:30
-
-
Save abbeyjackson/22b8684261d2f87b72f9 to your computer and use it in GitHub Desktop.
multiple buttons and one delegate function, using tags and protocol, in Swift
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
import UIKit | |
protocol ScrollBarDelegate { | |
func buttonPressed(scrollBar: ScrollBar, sender: UIButton) | |
} | |
class tempScrollBar: UIView { | |
weak var delegate: ScrollBarDelegate? | |
@IBAction func buttonPressed(sender: UIButton) { | |
delegate?.buttonPressed?(self, sender: sender) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment