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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:40:26+00:00 2026-06-03T20:40:26+00:00

i have an array of objects which i am populating in a UItable one

  • 0

i have an array of objects which i am populating in a UItable one of my attributes of each object is a YES/NO value

Im using the- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { to populate my table as follows .

My code creates a table entry for each object in the array. I would like to only populate the table using objects in the array which have the “display” attribute set to YES? how do i do this?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellidentifier = @"customcell";
customcell *cell = (customcell *)[tableView dequeueReusableCellWithIdentifier:
                                  cellidentifier];

my_details *myObj = [appDelegate.myArray objectAtIndex:indexPath.row];

// UITableViewCell cell needs creating for this UITableView row.
if (cell == nil)

{
    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"customcell" owner:self options:nil];

    for (id currentObject in topLevelObjects) {
        if ([currentObject isKindOfClass:[customcell class]]) {
            cell = (customcell *) currentObject;
            break;
        }
    }
}


    cell.line1.text = myObj.line1;
    cell.line2.text = myObj.line2;
    cell.line3.text = myObj.line3;


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-06-03T20:40:28+00:00Added an answer on June 3, 2026 at 8:40 pm

    It would be a good idea to try to filter the objects before sending them to the table for display.

    You could use an NSPredicate to filter the array of objects and when an object changes it’s state, the display attribute is set to yes, refilter the array and pass it to the tableview.

    NSPredicate *testForTrue = [NSPredicate predicateWithFormat:@"display == YES"];
    NSArray *filteredArray = [myObjectsArray filteredArrayUsingPredicate:testForTrue];
    

    after you obtain the filteredArray you need to pass it to the tableView and tell it to reload it’s data in order to refresh.

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

Sidebar

Related Questions

So I have an array with objects which each have several attributes including an
I have an array of FileReference objects which have several listeners attached to each
I have an array of objects which I want to sort based on one
I have an array of Person objects (which has a number of attributes). I
I have the following array of objects which I need to convert to one
I have an array of objects in javascript, each of which in turn has
I have a List of objects which contain a string array as one of
I have an array of DataRow objects in my C# project which I would
I have an array of Deferred objects, which I'm trying to map to their
I have a method which returns an array of fixed type objects (let's say

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.