0

I have a class I call InputView that is a subclass of UIView that contains a UITextField and a UILabel. Due to how my InputView is designed, I have it implement the UITextFieldDelegate protocol so I can do a bunch of things when its UITextField is edited.

I then have a View Controller that has multiple InputView's in it. I want to create a new InputView whenever the first InputView in the VC is filled up. Now I could do this using a simple check in the function that is called when a UITextField ends editing, and just check if the InputView is filled up or not, but as I said, InputView already implements the UITextFieldDelegate protocol.

I want to "send" a signal from an InputView, that I can catch in my VC and then run a function that creates a new InputView. If you're confused, see the following image: enter image description here

JoeVictor
  • 1,806
  • 1
  • 17
  • 38

1 Answers1

1

You can use notification to trigger an action in you View Controller.

Use this answer How to post and receive an notification?

Community
  • 1
  • 1
Naresh
  • 334
  • 1
  • 4
  • 17