user1498119
user1498119

Reputation: 839

How can i deselect the unselected buttons

Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and apply the gesture effect.i am able to change the selected button image.But how can i change the un select button image.My code in gesture selector methd is looks like

-(void)cellchange:(UITapGestureRecognizer *)recognizer
{
UIImage *cellselect=[UIImage imageNamed:@"radio_on_1.png"];
UIImage *cellunselet=[UIImage imageNamed:@"radio_off_1.png"];
 UIImageView *img=(UIImageView *)recognizer.view;
for(int k=0;k<[ages count];k++)
{

    if(img.tag==k)
    {
        UIImage *selectimg=img.image;
        if([selectimg isEqual:cellselect])
        {
            img.image=[UIImage imageNamed:@"radio_off_1.png"];

        }
        if([selectimg isEqual:cellunselet])
        {
            img.image=[UIImage imageNamed:@"radio_on_1.png"];
        }

    }
     }
    }

so please tell me how to change the unselected buttons images.

Upvotes: 0

Views: 123

Answers (1)

Nina
Nina

Reputation: 1679

I believe the better way would be using 'Button' instead of 'Image'. When tapped check whether it is in selected mode or unselected mode, then set image for button accordingly!

Upvotes: 1

Related Questions