PDA

View Full Version : Fast Enumeration Not Working




Darkroom
Jul 22, 2009, 07:57 PM
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.


- (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?



PhoneyDeveloper
Jul 22, 2009, 09:13 PM
What this code does is

this code commands to only goto highlightPressedButton:sender if ANY highlights are currently of zero alpha!

Darkroom
Jul 22, 2009, 09:18 PM
oh... :o