سؤال

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;
هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top