Frage

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;
War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top