I have four UIButton's and each has an associated UIPopUpMenu. Each UIMenuElement has the same action and menu list across all four UIButtons's. My selector essentially does the same action, but saves the data into an Array based on which UIButton was originally selected to get to the UIMenu.
This is my action definition: @IBAction func changeName (sender: UIMenuElement) { }
If I try to use "sender: UIButton" instead, I get a fatal error. However, I can't seem to find out how to get a reference to the UIButton touched when using the "sender: UIMenuElement". I need the Tag from that button to determine where to save the information.
See my comment for my solution. Happy to share more details if anyone is curious. Thanks.
Where
allPlayersis my list of the player names,iis from the for..next adding each name to the menu, andjis from the for..next adding the menu to each button.