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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:13:55+00:00 2026-06-01T08:13:55+00:00

I have a UITableView that has five sections. Just as the title describes cellForRowAtIndexPath

  • 0

I have a UITableView that has five sections. Just as the title describes cellForRowAtIndexPath is only being called for the first four. All connections have been made concerning the datasource and delegate. Also, my numberOfSectionsInTableView clearly returns 5. Printing out the number of sections from within cellForRowAtIndexPath shows the correct number, thus confirming that cellForRowAtIndexPath is simply not being called for all sections. What on earth is going on? I looked pretty hard for an answer to this question but could’t find one. If this has already been answered please forgive me and point me in the correct direction.

My cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    switch (indexPath.section) {
        case 0:
            cell.textLabel.text = ticket.description;
            break;
        case 1:
            cell.textLabel.text = ticket.ticketStatus;
            break;
        case 2:
            cell.textLabel.text = ticket.priority;
            break;
        case 3:
            cell.textLabel.text = ticket.customerOfficePhone;
            break;
        case 4: {
            //This never ever gets executed
            Comment *comment = [ticket.comments objectAtIndex:indexPath.row];
            cell.textLabel.text = comment.commentContent;
            break;
        }
    }

    return cell;
}

My numberOfSectionsInTableView:

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

My numberOfRowsInSection:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSInteger numberOfRows;

    if (section == 4) {
        numberOfRows = [ticket.comments count];
    }
    else {
        numberOfRows = 1;
    }

    return numberOfRows;
}

Any suggestions are appreciated. Thanks in advance.

  • 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-01T08:13:57+00:00Added an answer on June 1, 2026 at 8:13 am

    Ah-ha! I figured it out. I had forgotten that I had hard coded the frame for my table view and added it as a subview with the scroll disabled to a scroll view. Unfortunately both the scroll view and the tableview were too small in terms of height to hold the fifth section which i suppose was the reason cellForRowAtIndexPath was being called for all sections except the fifth one. Readjusting the height of my table view and scroll view to be a little bigger has solved my problem.

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

Sidebar

Related Questions

I have a grouped UITableView that has 3 sections. I would like to show
I have a very simple UITableView that has 3 sections, and 3 rows per
I have a UITableView that is grouped into sections and has a number of
I have a UITableView that has 3 sections. My individual cells vary in height
I've got a UITableView that has 20 sections. At the top I have a
I have a UITableView that is being populated from an NSMutable array that has
Is it possible to have a UITableView that has a fixed height for all
I have a custom UITableView cell that has a UIImageView sized to the width
I have an application that has a UITableView. This UITableView is populated by an
I have a UITableView that displays various nsstrings from a custom object called a

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.