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 6020707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:36:27+00:00 2026-05-23T03:36:27+00:00

In my table view I have 4 UIButton s, 2 in each row of

  • 0

In my table view I have 4 UIButtons, 2 in each row of table view. Initially all the buttons have an image on them (they’re hardcoded). Now there is a button in my app which when tapped replaces the images on the buttons with new ones using the setImage method and then reloads the table view. But unfortunately I am getting the old table view only i mean with old images. How can I get the new images on the buttons?

My cellForRowAtIndexPath implementation:-// Customize the appearance of table view cells.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    // if (cell == nil) {
    // cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    // }
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    if(indexPath.row == 0)
    {
        button1=[[UIButton alloc] initWithFrame:CGRectMake(15,5,100,87)];
        [button1 setImage:[UIImage imageNamed:@"BUTTON.png"] forState:UIControlStateNormal];
        [button1 addTarget:self action:@selector(ClickTo:) forControlEvents:UIControlEventTouchUpInside];
        [cell.contentView addSubview:self.button1];

        button2=[[UIButton alloc] initWithFrame:CGRectMake(135,5,100,87)];
        [button2 setImage:[UIImage imageNamed:@"TURN OFF.png"] forState:UIControlStateNormal];
        [button2 addTarget:self action:@selector(ClickTo:) forControlEvents:UIControlEventTouchUpInside];
        [cell.contentView addSubview:button2];
    }
    else if(indexPath.row == 1)
    {
        button3=[[UIButton alloc] initWithFrame:CGRectMake(15,5,100,87)];
        [button3 setImage:[UIImage imageNamed:@"JUMP.png"] forState:UIControlStateNormal];
        [button3 addTarget:self action:@selector(ClickTo:) forControlEvents:UIControlEventTouchUpInside];
        [cell.contentView addSubview:button3];


        button4=[[UIButton alloc] initWithFrame:CGRectMake(135,5,100,87)];
        [button4 setImage:[UIImage imageNamed:@"CLOSE.png"] forState:UIControlStateNormal];
        [button4 addTarget:self action:@selector(ClickTo:) forControlEvents:UIControlEventTouchUpInside];
        [cell.contentView addSubview:button4];
    }
    else
    {
        // Do something here
    }
    return cell;
}
  • 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-23T03:36:28+00:00Added an answer on May 23, 2026 at 3:36 am

    You are probably setting the image for the wrong state:

    [myButton setImage:[UIImage imageNamed:@"myImage.png"] forState:UIControlStateNormal];

    You need to set the correct value for UIControlStateNormal – where correct means the one that matches your buttons’ current state(s).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some uiButtons in my table view and i want to load them
i have a table view. And im adding two buttons to each cell: -
I have added a UIButton in a table view. Now when I click a
I have a simple table view which is editable. All I need the user
I have a table view and I'm toggling its dataDource with two UIButtons (like
In my application, i'm using a customised table. Each cell have an uibutton and
I have a table containing images and buttons. Each button has a tag with
I have a table view and some buttons inside it. 4 buttons in one
i have an customized cell that is loaded in table view cell and each
Ok i have a table view that can add and delete cells. For each

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.