Katakam Nikhil Katakam Nikhil - 8 months ago 27
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



Please try the following