What's the best way to call an IBAction from within code?
        Posted  
        
            by Rob
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Rob
        
        
        
        Published on 2010-05-22T19:07:09Z
        Indexed on 
            2010/05/22
            19:10 UTC
        
        
        Read the original article
        Hit count: 309
        
Say for instance I have an IBAction that is hooked up to a button in interface builder.
- (IBAction)functionToBeCalled:(id)sender
{
   // do something here   
}
Within my code, say for instance in another method, what is the best way to call that IBAction?
If I try to call it like this, I receive an error:
[self functionToBeCalled:];
But, if I try to call it like this (cheating a bit, I think), it works fine:
[self functionToBeCalled:0];
What is the proper way to call it though?
© Stack Overflow or respective owner