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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:57:26+00:00 2026-05-30T05:57:26+00:00

I made a very simply table view, with load more function. I have added

  • 0

I made a very simply table view, with load more function.
I have added a custom view on the last cell with text “Load More”
After the user clicked the load more function, the rows increased successfully.
But the text “Load More” didn’t disappear.
Please help.

Here is my code.

- (void)viewDidLoad {
    [super viewDidLoad];

    noRow = 10;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return noRow+1;
}

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

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (indexPath.row != noRow ) { // As long as we haven’t reached the +1 yet in the count, we populate the cell like normal
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Set up the cell...
    NSString *cellValue = [[NSNumber numberWithInt:[indexPath row]] stringValue];

    cell.text = cellValue;
    } // Ok, all done for filling the normal cells, next we probaply reach the +1 index, which doesn’t contain anything yet

    else if(indexPath.row == noRow ) { // Here we check if we reached the end of the index, so the +1 row
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        }
        UILabel *loadMore;

        loadMore =[[UILabel alloc]initWithFrame: CGRectMake(0,0,320,50)];
        loadMore.textColor = [UIColor blackColor];
        loadMore.highlightedTextColor = [UIColor darkGrayColor];
        loadMore.backgroundColor = [UIColor clearColor];
        loadMore.font=[UIFont fontWithName:@"Verdana" size:20];
        loadMore.textAlignment=UITextAlignmentCenter;
        loadMore.font=[UIFont boldSystemFontOfSize:20];
        loadMore.text=@"Load More..";
        [cell addSubview:loadMore];


    }        
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    if(indexPath.row == noRow){
        NSLog(@"noRow Prev: %d", noRow);
        noRow += 5;
        NSLog(@"noRow After: %d", noRow);
        [self.tableView reloadData];

    }else{
        NSLog(@"IndexPath.row: %d", indexPath.row);
    }
}
  • 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-30T05:57:27+00:00Added an answer on May 30, 2026 at 5:57 am

    You are reusing the and you are not removing the view that you have added for load more

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        static NSString *CellIdentifier = @"Cell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        [[cell viewWithTag:121] removeFromSuperview];//remove this tag view
        if (indexPath.row != noRow ) { // As long as we haven’t reached the +1 yet in the count, we populate the cell like normal
            if (cell == nil) {
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
            }
    
            // Set up the cell...
            NSString *cellValue = [[NSNumber numberWithInt:[indexPath row]] stringValue];
    
            cell.text = cellValue;
        } // Ok, all done for filling the normal cells, next we probaply reach the +1 index, which doesn’t contain anything yet
    
        else if(indexPath.row == noRow ) { // Here we check if we reached the end of the index, so the +1 row
            if (cell == nil) {
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
            }
            UILabel *loadMore;
    
            loadMore =[[UILabel alloc]initWithFrame: CGRectMake(0,0,320,50)];
            loadMore.textColor = [UIColor blackColor];
            loadMore.highlightedTextColor = [UIColor darkGrayColor];
            loadMore.backgroundColor = [UIColor clearColor];
            loadMore.font=[UIFont fontWithName:@"Verdana" size:20];
            loadMore.textAlignment=UITextAlignmentCenter;
            loadMore.font=[UIFont boldSystemFontOfSize:20];
            loadMore.text=@"Load More..";
            loadMore.tag = 121;// just setting the tag
            [cell addSubview:loadMore];
    
    
        }        
        return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a very simple custom object pictureData . Here is the .h
I have made a very simple AppleScript to close tabs in Safari. The problem
in my application I made a very simple binding. I have a NSMutableArray bound
We have a number of very old data entry forms that were made in
I am a very new programmer, I have made a couple basic applications, however
I have a very simple SSIS package where I take data from a view
I have a table that isn't going to get very big and contains the
I have a very simple SQL query that I made which retrieves some user
I have made a custom CMS and I'd like to make it multi-client while
I have a JTable with a custom Cell Renderer for multi-line cells. Everything is

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.