I want fire a button event(or maybe method) in code,the button was generate by iPhone SDK , I can not update it, so I add the action to the button, the code likes as follows:
[theButton addTarget:self action:@selector(onButtonEvent:)
forControlEvents:UIControlEventAllTouchEvents];
-(void) onButtonEvent:(id)sender
{
AppTrace2(self, @"onButtonEvent", sender);
}
and when I tap the button, the app will execute a function that was produce by iPhone sdk, also the new method 'onButtonEvent' will be executed, and then I try to add some code as follows:
[theButton sendActionsForControlEvents: UIControlEventTouchDown];
[theButton sendActionsForControlEvents: UIControlEventTouchDownRepeat];
[theButton sendActionsForControlEvents: UIControlEventTouchDragInside];
[theButton sendActionsForControlEvents: UIControlEventTouchDragOutside];
[theButton sendActionsForControlEvents: UIControlEventTouchDragEnter];
[theButton sendActionsForControlEvents: UIControlEventTouchDragExit];
[theButton sendActionsForControlEvents: UIControlEventTouchDragInside];
[theButton sendActionsForControlEvents: UIControlEventTouchDragOutside];
[theButton sendActionsForControlEvents: UIControlEventTouchUpInside];
[theButton sendActionsForControlEvents: UIControlEventTouchUpOutside];
[theButton sendActionsForControlEvents:UIControlEventTouchDown];
[theButton sendActionsForControlEvents:UIControlEventAllEvents];
but it does not call the original functions which was produced by iphone sdk, although the new method 'onButtonEvent' also was executed when above sendActionsForControlEvents executed .... my goal is to invoke the original function ... sdk does not provide tip on this , so I have to simulate the tap event to invoke the function to executed ....
any one can give a tip on this problem ?
Thanks for your time!
Regards