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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:21:38+00:00 2026-05-11T20:21:38+00:00

i am using a function to fill dictionary in a array here is the

  • 0

i am using a function to fill dictionary in a array
here is the code

    -(void)getAllFlashCardsNames
 {
if ([listofitems count]==0)
    listofitems = [[NSMutableArray alloc] init];
else
    [listofitems removeAllObjects];

for(int i=0;i<listOfCategoryId.count;i++)
{   
    int j=[[listOfCategoryId objectAtIndex:i]intValue];
    [self getFlashCard:j];      
    NSArray *flashCardsNames = flashCardsNamesList;
    NSArray *flashCardsids = flashCardsId;
    NSLog(@"FLash Card Ids %@",flashCardsids);      
    NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:flashCardsNames,@"flashCards",flashCardsids,@"flashCardId",nil];
    [listofitems addObject:dictionary];

}

}

in the above code the array flashcardsNamesList,flashCardsId changes everytime when calling the function [self getFlashCard:j]; j is a parameter to change categoryid which comes from the listOfCategoryId array..

now how do i retrieve values from the dictionary i want to show different flashcardsNames on different sections in uitableview.

here is the code i m using to retrieve values

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
return [listofitems count];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section   {   
    NSDictionary *dictionary =[listofitems objectAtIndex:section];
    NSLog(@"dictionary=%@",dictionary);
    NSArray *array =[dictionary objectForKey:@"flashCards"];
    NSLog(@"array=%@",array);
    NSLog(@"Section Count = %d",array.count);
    return array.count; 
}   



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {   
    static NSString *CellIdentifier = @"Cell";  
    CustomCell *cell = (CustomCell   *)[tableViewdequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) {      
        cell = [[[CustomCell alloc] initWithFrame:CGRectZero     reuseIdentifier:CellIdentifier] autorelease];      
    }   

    NSDictionary *dictionary =[listofitems objectAtIndex:indexPath.section];
    NSArray *array =[dictionary objectForKey:@"flashCards"];
    NSArray *array1=[dictionary objectForKey:@"flashCardId"];
    NSString *cellValue=[array objectAtIndex:indexPath.row];
    NSString *cellValue1=[array1 objectAtIndex:indexPath.row];
    [cell.FlashCardsNames setText:cellValue];
    [cell setFlashCardId:[cellValue1 intValue]];
    return cell;
}

but the method
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath does not get called

  • 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-11T20:21:38+00:00Added an answer on May 11, 2026 at 8:21 pm

    but the method -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath does not called

    Have you set the object that your method is implemented in as the data source of your table view? UITableView hands some of the work off to another object, which must conform to the UITableViewDataSource and UITableViewDelegate protocols; you must then set the object as the dataSource and delegate of the table view, either in IB or programmatically (the data source and delegate can be different objects, but are commonly the same object). Take a look at this article which explains more about it; once this has been done, your object must handle the tableView:cellForRowAtIndexPath: and tableView:numberOfRowsInSection: methods, which will be called on your object by the table view.

    Also, the lines:

    if ([listofitems count]==0)
        listofitems = [[NSMutableArray alloc] init];
    

    do not make sense. I assume you are checking whether the array has been allocated or not, and if not, to allocate it. If the array hasn’t been allocated, it will be nil, so sending count to it will have no effect anyway. If it has been allocated previously, but deallocated but not reverted back to nil it will be a bad pointer and cause your application to crash.

    A better way to allocate it would be to do so in your class’s awakeFromNib method, or applicationDidFinishLaunching: method, if you are implementing this in your UIApplicationDelegate subclass. Don’t forget to release it in your dealloc method.

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

Sidebar

Ask A Question

Stats

  • Questions 120k
  • Answers 120k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer CsvReader is a pretty good one... it isn't Microsoft, but… May 12, 2026 at 12:06 am
  • Editorial Team
    Editorial Team added an answer Figured it out on the KDE forums here. Porges's solution… May 12, 2026 at 12:06 am
  • Editorial Team
    Editorial Team added an answer Personally I find that I need a substantial project to… May 12, 2026 at 12:06 am

Related Questions

I need to write, in JavaScript (I am using jQuery), a function that is
I've got a philosophical programming problem. Let's say I have a class named Employees.
Recently I wrote a function to generate certain sequences with nontrivial constraints. The problem
I have a range of random numbers. The range is actually determined by the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.