Katakam Nikhil Katakam Nikhil - 1 year ago 76
iOS Question

Find out the parent view of a clicked button in swift

I have some code where I have 3 buttons and I would like to find out the parent view of those buttons when clicked

@IBAction func resizeButtonClicked(sender: UIButton) {
if(sender.isEqual(resizeButton)) {
//This is to convert to small square
} else if(sender.isEqual(maximizeButton)) {
//This is to convert to maximized view
} else if(sender.isEqual(closeButton)) {
//This is to close the view completely


Now I can identify the sender button but how do I identify the view this button is sitting in?

Thank you


Answer Source

Please try the following

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download