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

  • Home
  • SEARCH
  • 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 7847017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:46:10+00:00 2026-06-02T17:46:10+00:00

I have created a row of numberButtons inside a view dynamically.I am getting button

  • 0

I have created a row of numberButtons inside a view dynamically.I am getting button highlighted when clicking any number.If I am clicking more than 1 in that row ,all of the clicked buttons get highlighted.What to do for avoiding multiple highlation?

I have used the code as follows

-(void)pressed:(id)sender{
    UIButton *button = (UIButton *)sender;
    if(!button.selected){

        [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(highlightButton:) userInfo:button repeats:NO];        

    } else {
        [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(unhighlightButton:) userInfo:button repeats:NO];
    }
-(void)highlightButton:(id)sender{
    UIButton *button = (UIButton *)[sender userInfo];
    button.highlighted = YES;
    button.selected = YES;
}
-(void)unhighlightButton:(id)sender{
    UIButton *button = (UIButton *)[sender userInfo];
    button.highlighted = NO;
    button.selected = NO;
}
  • 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-06-02T17:46:12+00:00Added an answer on June 2, 2026 at 5:46 pm

    I’m assuming that you mean that every button you tap is highlighted without removing the previous highlight.

    To only have one button highlighted at a time. Keep track of what button was highlighted and remove its highlight when tapping another button.

    - (void)buttonTapped:(UIButton *)button {
        if (button != [self lastSelectedButton]) { // don't re-highlight the same button
            // remove the highlight of "lastSelectedButton"
    
            [self setLastSelectedButton:button];
            // add the highlight to "lastSelectedButton" (not updated to the new button)
        }
    
        // Do the rest of you button logic here ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom list view, each row has it's own custom selector,
I have created a custom listview using adapter. Each row of the list view
in my app, i have created table rows dynamically in each table row, i
I have created a Table layout with a number of rows and each row
I have created a grouped table view & I had a edit button in
I have created a web service in WCF which returns more than 54000 data-rows
I am looking to drag a row from the jqGrid I have created and
I have created a user control that contains a button. I am using this
I have created custom listview, each row looks like my file custom_row.xml. Is there
i have created a TabBar Application. I Added to a view an UITableView and

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.