문제

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