Fast Enumeration Not Working

Discussion in 'iOS Programming' started by Darkroom, Jul 22, 2009.

  1. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #1
    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?
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    What this code does is

     

Share This Page