Setting custom goals and actions in Interface Builder

I have a custom control that is often reused. It is designed for long printing. I would like to be able to set the target and selector in the interface builder. Is there a way to have something like -

@property (nonatomic,assign) IBOutlet SEL longPressSelector; 

Alternatively, is there a way to add custom UIControlEvents that can be installed in Interface Builder?

thanks

+7
source share
1 answer

I think you can use

 -(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event 

to start NSTimer, which will take the time for you

and

 -(void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event 

to stop this timer and get how long the user is listening to the view, and then you can make an event in accordance with this time for a long press.

Hope this helps you.

-3
source

All Articles