iPhone, how to fire a button event in programmatically
<p>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:</p>

<pre><code>[theButton addTarget:self action:@selector(onButtonEvent:) 
       forControlEvents:UIControlEventAllTouchEvents];

 -(void) onButtonEvent:(id)sender
{   
    AppTrace2(self, @"onButtonEvent", sender);   
}
</code></pre>

<p>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:</p>

<pre><code>[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];
</code></pre>

<p>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 .... </p>

<p>any one can give a tip on this problem ?</p>

<p>Thanks for your time!</p>

<p>Regards</p>
