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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:35:12+00:00 2026-05-23T02:35:12+00:00

I have a button on my tableview cell. But after scrolling the buttons look

  • 0

I have a button on my tableview cell.
But after scrolling the buttons look like this:

enter image description here

It looks like there is sometimes one button above the other.
How can I solve this problem?

That’s my code for the button in cellForRowAtIndexPath

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

Chapter *chapter = nil ;
UITableViewCell *cell = nil;
NSUInteger row = [indexPath row];
switch (indexPath.section) {
    case 0: 
        chapter = [[einfuerung objectAtIndex:row]retain];
        break;
    case 1: 
        chapter = [[vertiefung objectAtIndex:row]retain];
        break;
    case 2: 
        chapter = [[spezial objectAtIndex:row]retain];
        break;
}


if ([self filesFromFolderWithChapter:chapter] > 1) 
{

    static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
    cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
    if (cell == nil) 
    { 
        cell = [[[UITableViewCell alloc]
                initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:SimpleTableIdentifier] autorelease];
    }
}   
else {

    static NSString *ButtonTableIdentifier = @"ButtonTableIdentifier";
    cell = [tableView dequeueReusableCellWithIdentifier: ButtonTableIdentifier];
    if (cell == nil) 
    { 
        cell = [[[UITableViewCell alloc]
                initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ButtonTableIdentifier] autorelease];
    }

}



    NSString *firstString;
    NSString *lastString;

    switch (indexPath.section) {
        case 0: 
            chapter = [[einfuerung objectAtIndex:row]retain];
            [dataInstance extractFromString: [chapter title]: &firstString: &lastString];
            cell.textLabel.text = firstString; 
            cell.detailTextLabel.text = lastString;
            cell.backgroundColor = [UIColor whiteColor];


            break;
        case 1: 
            chapter = [[vertiefung objectAtIndex:row]retain];
            [dataInstance extractFromString: [chapter title]: &firstString: &lastString];
            cell.textLabel.text = firstString; 
            cell.detailTextLabel.text = lastString;
            cell.backgroundColor = [UIColor whiteColor];

            break;
        case 2: 
            chapter = [[spezial objectAtIndex:row]retain];
            [dataInstance extractFromString: [chapter title]: &firstString: &lastString];
            cell.textLabel.text = firstString; 
            cell.detailTextLabel.text = lastString;
            cell.backgroundColor = [UIColor whiteColor];

            break;
    }



if ([self filesFromFolderWithChapter:chapter] > 1) 
{


        //VersionButton *button = [VersionButton buttonWithType:UIButtonTypeRoundedRect];
        VersionButton *button = [[VersionButton alloc]initWithFrame:CGRectMake(500, 15, 150, 30) andTitle:@"ältere Versionen"];
        button.chapter = chapter;
        [button addTarget:self action:@selector(versionTapped:) 
         forControlEvents:UIControlEventTouchUpInside];
        [cell.contentView addSubview:button];   
        [button release];

}
    [chapter release];

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-23T02:35:13+00:00Added an answer on May 23, 2026 at 2:35 am

    First of all it would be helpful to see your entire cellForRowAtIndexPath function.

    It looks like you are not accounting for cell reuse correctly. You should only add a button to your cell if you are creating a cell from scratch and not if a cell is being reused. If a cell is being reused you should have a way to access the button it already has and make any changes necessary to it.

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

Sidebar

Related Questions

I have two buttons inside sectioned tableview cell thumbs up and thumbs down. Initially
i have asked this question before but no answer was there. so asking again.
I have one issue with Datetime Picker In my firstview i have button.If i
I have one issue with UInavigationcontroller In my firstview i have button.If i click
I have a button that I would like to disable when the form submits
We have a button that saves asynchronously using AjaxToolKit/C#/.NET. I'm getting this in my
This is my code to delete a cell in my UITableView: - (void)tableView:(UITableView *)tableView
I created sample tableview application and I have an add button above the tableview,
I build a TableView with custom TableViewCell, the first custom cell have a tool
I have place this question before on following link with code & screenshot. TableView

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.