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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:01:27+00:00 2026-06-12T20:01:27+00:00

Basically, the cellForRowAtIndexPath function need to return a UITableViewCell. In my code, I would

  • 0

Basically, the cellForRowAtIndexPath function need to return a UITableViewCell. In my code, I would like to check a behaviour that will check something and skip the cell if a specific value is found.

Here’s what I have right now :

static NSString *FirstCellIdentifier = @"First Custom Cell";
static NSString *SecondCellIdentifier = @"Second Custom Cell";

CustomObject *o = [_customObjects objectAtIndex:indexPath.row];

if ([s.name isEqualToString:@""])
{
    FirstCellController *cell = [customList dequeueReusableCellWithIdentifier:FirstCellIdentifier];
    if (!cell) { 
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"FirstCustomCell" owner:self options:nil];
        for (id currentObject in topLevelObjects){
            if ([currentObject isKindOfClass:[UITableViewCell class]]){
                cell = (FirstCellController *) currentObject;
                break;
            }
        }
    }
    // Here I do something with the cell's content
    return cell;
}
else {
    SecondCellController *cell = [customList dequeueReusableCellWithIdentifier:SecondCellIdentifier];
    if (!cell) {
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"SecondCustomCell" owner:self options:nil];
        for (id currentObject in topLevelObjects){
            if ([currentObject isKindOfClass:[UITableViewCell class]]){
                cell = (SecondCellController *) currentObject;
                break;
            }
        }
    }
    // Here i do something with the cell's content
    return cell;
}

What I’d like to do is that if the s.name is not empty, I would like to “skip” the cell, not displaying it and go to the next one.

Anyone have some advice on this please ?

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-12T20:01:28+00:00Added an answer on June 12, 2026 at 8:01 pm

    You cannot “skip” a cell this way. If your datasource claims there are n rows, then you have to provide a cell for each of them. The correct way would be to modify your datasource to claim (n-1) rows when you want to remove one, then call UITableView reloadData to have it regenerate the table (and ask you for new cells for each visible row).

    Another option would be to “hide” a row/cell. The technique I’ve used for this is to provide a height of 0 for the given cell via heightForRowAtIndexPath:

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

Sidebar

Related Questions

I have a function that looks something like this: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
Basically, I have a UIImageView that will loop through 8 PNGs over 0.5 seconds.
Basically from C++ FAQ I learned that: A virtual function allows derived classes to
So, here's the code for my cellForRowAtIndexPath: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
I'm using the following code to populate a UITableViewController - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
Basically this function is meant to store the height value of the element that
Basically I have some simple code that does some things for files and I'm
Basically I have some code to check a specific directory to see if an
Basically, I would like a brief explanation of how I can access a SQL
Basically I need to get older version of a file in the repository without

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.