Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6214141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:49:28+00:00 2026-05-24T06:49:28+00:00

I know this is a common question topic. However I haven’t found an answer

  • 0

I know this is a common question topic. However I haven’t found an answer after extensive searching so I’m asking it here.

I have a UITableViewController where each row is an instance of a UITableViewCell subclass. Each UITableViewCell subclass has a UIButton. Initially all UIButtons have the same image (just a blue circle). Tapping a button causes only that button’s image to change (say to a red circle). This part is easy: just handle the tap inside the UITableViewCell subclass and toggle the image.

Here’s the challenging part: when I tap another blue button I want the button that’s currently red (if any) to toggle it’s image back to blue. How can I tell this button to toggle it’s image?

Where do I keep track of the button that’s currently red?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:49:30+00:00Added an answer on May 24, 2026 at 6:49 am

    Implement the - (void)setSelected:(BOOL)selected animated:(BOOL)animated method in your UITableViewCell subclass. When the cell is selected, make the UIButton image red; otherwise, set the UIButton image to blue. This method is called whenever a new cell is selected, so there will always be only one red-button cell.

    - (void)setSelected:(BOOL)selected animated:(BOOL)animated
    {
        if(selected)
        {
            [myButton setImage:RED_IMAGE forState:UIControlStateNormal]; //or however else you want to change your button's image
        }else
        {
            [myButton setImage:BLUE_IMAGE forState:UIControlStateNormal];
        }
    
        [super setSelected:selected animated:animated];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this a common question but everything I found seems to remove white
I know this must be a common question, but take a look: Here i
I know this is a very common (and basic) question, however I've tried without
I know this question is incredibly common, but I'm asking the following (Google yields
I know this is a very common question. But I've looked through SO and
I know this has probably been answered as it seems a common question but
I know this question has been asked numerous number of times, both here and
I know regex and substrings is a common question on here but i can
I know that this question is quite common, but its specifics are stumping me.
I know that this is a common question that was described a lot of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.