Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lRetro

macrumors newbie
Original poster
May 23, 2011
2
0
So I'm making a simple application that acts on a button. There are 8 other buttons in a circle and when the button is pressed each button for 60 milliseconds will disable and then re-enable in order, so it looks like it makes a circle.

All the logic for the enabling/disabling are in "void" functions, but it seems that I cannot call that function within an IBAction..

Is it possible to do so? I've been googling around and I haven't seen anything like it.

Example:
Code:
- (IBAction) activateButton:(id)sender{
void beginCircleBusy();
}

- (void) beginCircleBusy:(id)sender{
firstButton.enabled = NO;
[NSTimer scheduledTimerWithTimeInterval: .06 target:self selector:@selector(goToSecondButton:) userInfo: nil repeats:NO];
}

and so on..

Note: What HAS worked was associating that function using the Interface Builder to the button.. but I was just wondering if I can do this with code instead of the GUI and I want to use other functions after the function finishes.

Any helps appreciated! :3

-Retro
 
Last edited:
Like the guy said above me, you can call an action from your own class, or another class tha thas been inited/stored in memory.

by just calling [self classMethodName]; which u can give parameters etc.
or for example [secondController classMethodName]; if your secondController pointer is inited. kind off.

Gz
 
change
Code:
- (void) beginCircleBusy:(id)sender{
to
Code:
- (void) beginCircleBusy{
then in your IBAction
Code:
[self beginCircleBusy];

Nick

Like the guy said above me, you can call an action from your own class, or another class tha thas been inited/stored in memory.

by just calling [self classMethodName]; which u can give parameters etc.
or for example [secondController classMethodName]; if your secondController pointer is inited. kind off.

Gz

Thanks! It worked :3
 
So how would you use this method to point the embedYouTube function to an IBAction...?

Code:
- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {

Any ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.