I have ViewController and then two different ViewControllers that extend that main ViewController, one for the iPhone and the other for the iPad.
The iPad's ViewController instantiates a separate extended UIView and sets it as its own view. That view has some buttons, which I want to add its selector methods as some methods in the main ViewController. How can this be achieved?
So here's a way to visualize this:
Main ViewController
| iPhone ViewController
| iPad ViewController
| Some UIView Class --> Button must invoke method in Main View Controller
EDIT: I do not use interface builder at all.
Your question is a bit confusing, but if I understand, you can use code like this to setup the button:
[button addTarget:yourObject action:@selector(yourMethod:) forControlEvents:UIControlEventTouchUpInside];
So you set addTarget to the instance of MainViewController, and set the action to whatever the method is you want to call inside MainViewController. You should be able to do this in Interface Builder too as long as your method accepts IBAction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With