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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:21:52+00:00 2026-06-17T03:21:52+00:00

trying to make a cell which loads more, but i cant get it to

  • 0

trying to make a cell which loads more, but i cant get it to appear after the other cells, sorry for being vague but ill show you my code…

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [rows count] + 1;
}

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

    static NSString *postCellId = @"postCell";
    UITableViewCell *cell = nil;

    cell = [self.tableView dequeueReusableCellWithIdentifier:postCellId];

    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:postCellId];

    NSUInteger row = [indexPath row];
    NSUInteger count = [rows count];

    if (row == count) {
        loadMore = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 320, 25)];
        loadMore.backgroundColor = [UIColor colorWithRed:255.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:1.0];
        loadMore.font = [UIFont fontWithName:@"AvenirNext-Bold" size:18.0];
        loadMore.textColor = [UIColor colorWithRed:60.0 / 255.0 green:58.0 / 255.0 blue:55.0 / 255.0 alpha:1.0];
        loadMore.text = @"Load More...";
        loadMore.textAlignment = UITextAlignmentCenter;
        [cell.contentView addSubview:loadMore];


        displaying = [[UILabel alloc] initWithFrame:CGRectMake(0, 50, 320, 25)];
        displaying.backgroundColor = [UIColor colorWithRed:255.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:1.0];
        displaying.font = [UIFont fontWithName:@"AvenirNext-Bold" size:12.0];
        displaying.textColor = [UIColor colorWithRed: 115.0 / 255.0 green: 113.0/ 255.0 blue:112.0 / 255.0 alpha:1.0];
        displaying.text = [NSString stringWithFormat:@"Displaying %i Results", rows.count];
        displaying.textAlignment = UITextAlignmentCenter;
        [cell.contentView addSubview:displaying];

    } else {

    dict = rows[indexPath.row];

    thumbimgView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 80, 80)];
    businessLabel = [[UILabel alloc] initWithFrame:CGRectMake(103, 10, 207, 25)];
    locationLabel = [[UILabel alloc] initWithFrame:CGRectMake(103, 35, 207, 35)];
    locimgView = [[UIImageView alloc] initWithFrame:CGRectMake(220, 75, 20, 15)];
    distanceLabel = [[UILabel alloc] initWithFrame:CGRectMake(240, 75, 60, 15)];

    businessLabel.backgroundColor = [UIColor colorWithRed:255.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:1.0];
    businessLabel.font = [UIFont fontWithName:@"AvenirNext-Bold" size:18.0];
    businessLabel.textColor = [UIColor colorWithRed:60.0 / 255.0 green:58.0 / 255.0 blue:55.0 / 255.0 alpha:1.0];
    businessLabel.text = dict[@"business"];
    [cell.contentView addSubview:businessLabel];

    locationLabel.backgroundColor = [UIColor colorWithRed:255.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:1.0];
    locationLabel.font = [UIFont fontWithName:@"AvenirNext-Regular" size:14.0];
    locationLabel.text = dict[@"location"];
    locationLabel.textColor = [UIColor colorWithRed: 115.0 / 255.0 green: 113.0/ 255.0 blue:112.0 / 255.0 alpha:1.0];
    locationLabel.numberOfLines = 2;
    locationLabel.lineBreakMode = UILineBreakModeTailTruncation;

    [cell.contentView addSubview:locationLabel];

    listingLoc = [[CLLocation alloc] initWithLatitude:[dict[@"lat"] doubleValue] longitude:[dict[@"lon"] doubleValue]];

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

    float kilometers = [appDelegate.currentLoc distanceFromLocation:listingLoc] / 1000;

    int milesint = kilometers * 0.621371192;

    NSString *milesOut = [NSString stringWithFormat:@"%i miles", milesint];

    distanceLabel.backgroundColor = [UIColor colorWithRed:255.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:1.0];
    distanceLabel.font = [UIFont fontWithName:@"AvenirNext-Regular" size:12.0];
    distanceLabel.textColor =  [UIColor colorWithRed:128.0 / 255.0 green:128.0 / 255.0 blue:128.0 / 255.0 alpha:1.0];
    distanceLabel.text = milesOut;
    [cell.contentView addSubview:distanceLabel];

    NSArray *splitImages = [dict[@"image1"] componentsSeparatedByString:@", "];

    icon = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[splitImages objectAtIndex:0]]]];

    [thumbimgView setContentMode:UIViewContentModeScaleAspectFill];
    [thumbimgView setClipsToBounds:YES];

    thumbimgView.image = icon;
    [cell.contentView addSubview:thumbimgView];

    locimgView.image = [UIImage imageNamed:@"location-icon.png"];
    [cell.contentView addSubview:locimgView];

    cell.textLabel.text = dict[@"business"];
    cell.textLabel.hidden = YES;

    }

    return cell;
}

All it does is return the data from the array, and no cell is added after for the load more.. Many thanks.

  • 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-17T03:21:53+00:00Added an answer on June 17, 2026 at 3:21 am
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        NSUInteger row = [indexPath row];
        NSUInteger count = [rows count];
        UITableViewCell *cell = nil;    
    
        if (row == count) {
          // This is the bottom most cell, therefore display the More-Cell
          static NSString *postCellId = @"moreCell";
    
          cell = [self.tableView dequeueReusableCellWithIdentifier:postCellId];
          if (cell == nil) {  // it cannot be re-used, so create a new one
    
             cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:postCellId];
             // now add all sub views such as labels and buttons. 
             // If the layout is always the same then you may set it here. 
    
          }
          // Now it is either re-used or newly created. However, it carries all the subviews. 
          // Here set the values. You may set the layout here too, if the layout depends on data.
    
        } else {
          // Display a regular Post-Cell    
          static NSString *postCellId = @"postCell";
    
          cell = [self.tableView dequeueReusableCellWithIdentifier:postCellId];
          if (cell == nil) { // it cannot be re-used, so create a new one
    
             cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:postCellId];
             // now add all sub views such as labels and buttons. 
             // If the layout is always the same then you may set it here. 
    
          }
          // Now it is either re-used or newly created. However, it carries all the subviews. 
          // Here set the values. You may set the layout here too, if the layout depends on data.
    
        }
    
        return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a table cell that when tapped calls a phone
I'm trying make an entity with doctrine that has three associations with other entities
I am fairly new to iOS development and trying make a simple app which
Trying to make a small countdown timer in my app but it's not working.
I am trying to make a simple program which involves a tableView. When I
I am trying to make a button in Excel which copies a certain range
I am trying to make edge relation from excel file which are organized in
I am trying to make a jtable which displays a list of users. The
I am trying to make a heatmap using d3 which on x axis a
I'm trying to use the following JavaScript function to get a particular cell value

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.