I have several drumpads set up on my view and they all connect to a drumPadPlay IBAction method. I would like to determine the y-axis location of the user's press inside the sender button to adjust the volume the drum pad will play at. I'm using swift.
Before this is flagged as a duplicate question I have referenced this question and the solution did not work for the current version of swift, or perhaps I don't know what to put where the answer says "buttonView". Detect what is the location of the tap/press inside UIButton inside sender action method
@IBAction func drumPadPressed(sender: BNDrumPad, event: UIEvent) {
//...code for function here
// get any touch on the buttonView
if let touch = event.touchesForView(sender.)?.anyObject() as? UITouch {
// print the touch location on the button
println(touch.locationInView(buttonView))
}
//...more code for function here
}
Here is my code - the error is "use of unresolved identifier 'buttonView'" I don't know what to use for buttonView. I have tried sender.superview! and searched through sender's list of properties/functions and couldn't find anything that looked like it would help.