views:

43

answers:

1

Can i call a IBaction from this

- (void)runScheduledTask {

}

i wish to call this IBAction:

  • (IBAction)GetSms {

}

+3  A: 

Yes.

- (void) runScheduledTask {
   [self GetSms];
}

IBAction is the equivalent of void and is only used as an identifier by Interface Builder.

Eric
ahh thank you :) saved me alot of time
Just keep note: you might have a design flaw if you have to call an IBAction from your own code. IBActions are specifiers for Interface Builder to know that the methods can be bound to interface objects, and while calling IBAction methods is perfectly legal and allowed, you might want to rethink your structure if you find yourself initiating actions that the user himself is supposed to initiate. To clarify, it is more structurally valid to have an IBAction called `calculate` that calls `[self calculateBalance]` than to have to call an IBAction that is called `calculateBalance` and call it.
itaiferber