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

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
on screen i have 2 buttons. when they are tapped, they become highlighted. i'm trying to make it so that only one button can be highlighted at once.

Code:
- (void)viewDidLoad
{
NSMutableArray *aHighlightsArray = [[NSMutableArray alloc] initWithObjects: buttonHighlight1, buttonHighlight2, nil];
self.highlightsArray = aHighlightsArray;
[aHighlightsArray release];
}

- (IBAction)menuTouchDown:(id)sender
	{
	for (id Objects in highlightsArray)
		if ([Objects alpha] == 0.0)
			[self highlightPressedButton:sender]
	}

the above snippet evaluates all objects in the highlightsArray. if all of them have a zero alpha (IE no button has been tapped), it will highlight the sender button. but even with this code when one button is highlighted i can still press the other button and have them both highlighted. this code commands to only goto highlightPressedButton:sender if all highlights are currently of zero alpha!

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