2
votes

I am creating a view class that inherits from UIView. I want to expose some events (like UIButton has: Touch Down, Touch Up Inside, Touch Up Outside, etc.). I found online how to fire up an event, but how do I expose it so that the user can assign an IBAction to it (e.g. so that it is shown in the interface builder like it does for UIButton)?

Thanks!

1

1 Answers

0
votes

Declare a method in your UIView's header file and mark its return type as IBAction (this is merely a marker for a void return type that IB uses to identify wire-able actions/methods).

- (IBAction)userCausedViewEvent;

Now when you crate a UIView and assign its class type to your UIView subtype in Interface Builder, userCausedViewEvent should be a selectable/wire-able event method.