tags:

views:

15

answers:

0

Hi,i m creating button through coding.When specific button is selected i m setting its alfa to zero & then appropriated text is assign to that button after which its alfa is set to 1.But problem is that if i selected more than one button at a time then last selected button gets the alfa 1 and rest of all remain in highlighted state.I want for such condition rest of all selected button should get alfa zero.

Please help me.

This is my code

-(IBAction)buttonPressed:(id)sender
{
    isSetIndexCalled = FALSE;   
    UIColor *color = [UIColor blueColor]; 
    for (int i=0; i<PUZZLESIZE*PUZZLESIZE; i++) 
    {
        UIButton *label = [objectArray objectAtIndex:i];
        if (label.tag==i) 
        {
            if(label == sender)
            {
                UIColor *color2 =  [label titleColorForState:UIControlStateNormal];
                if(label.currentTitle == @"" || color2 == color)
                {
                    currentCellIndex =i;
                    label.alpha=0;
                    isSelectedSudokuCellFixed = FALSE; 
                }
                else
                {
                    isSelectedSudokuCellFixed = TRUE;
                }   
            }
        }
    }       
}

-(IBAction) buttonChoicePressed:(id)sender
{   
    UIButton *buttonSender = (UIButton *)sender;
    NSString *captureText =[buttonSender currentTitle];

    for (int i=0; i<PUZZLESIZE*PUZZLESIZE; i++) 
    {
        if(i==currentCellIndex && !isSelectedSudokuCellFixed)
        {               
            UIButton *label = [objectArray objectAtIndex:i];
            [label setTitle:captureText forState:UIControlStateNormal];
            label.alpha=1;
            [objectArray replaceObjectAtIndex:i withObject:label];
        }
    }
}

Thanks