1

I have a Container View that contains a view. I want to change this view to another, calling a method of the parent view when the user interacts with an object of this child view.

How can I do this?

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
alessionossa
  • 923
  • 2
  • 15
  • 41

1 Answers1

2

let say the container is a class named 'ContainerView' and it has a function called 'changeSubView'
from the child view you can call it using:

let containerView = self.superview as! ContainerView
containerView.changeSubView()
Aziz
  • 612
  • 1
  • 6
  • 11