Question

Is it possible to have IBAction property (like touchUpInside in UIButton?) for my custom view so I could link it with IBAction in Interface Builder?

It should look similar to this in my view header file:

@property IBOutlet <IBAction_type> myCustomIBAction;
Was it helpful?

Solution

In your view controller's interface declaration, define a method with a return type of IBAction that takes single parameter of type id:

- (IBAction)buttonWasTapped:(id)sender;

Then in Interface Builder, right-click the button and drag from Touch Up Inside to your view controller. Select buttonWasTapped: from the popover.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top