PDA

View Full Version : How To Trigger A Button's Action Programmatically




loon3y
Mar 7, 2012, 02:32 PM
how can a program a button so it triggers another buttons actions?



mfram
Mar 7, 2012, 03:57 PM
Just call the other button's IBAction function.

jackhdev
Mar 7, 2012, 04:34 PM
how can a program a button so it triggers another buttons actions?

Just link the IBActions from the other buttons to that button.

vultureboy
Mar 7, 2012, 06:10 PM
As people have mentioned previously you can just link it to that action in interface builder.

If you wished to do something else on the second button Before calling the first buttons actions then link the button 2 to it's own action and then call the first buttons method like...


- (IBAction) button2Touch:(id)sender
{
NSLog(@"Do Something Else Now");
[self button1Touch:sender];
}