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

  • Home
  • SEARCH
  • 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 8969621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:37:07+00:00 2026-06-15T17:37:07+00:00

Possible Duplicate: How to Get Data from a PList into UITableView? I have a

  • 0

Possible Duplicate:
How to Get Data from a PList into UITableView?

I have a plist with Dictionary and numbers of strings per dictionary.show into the url below.and this list of items is in thousands in the plist.

Now want to display these list into the tableview

eneter image
.

now how can i display this plist into the UITableView

what I am trying is:

- (id)readPlist:(NSString *)fileName 
{

NSString *error;
NSPropertyListFormat format;
id plist;

NSString *localizedPath = [[NSBundle mainBundle] pathForResource:@"A" ofType:@"plist"];

dic =[NSDictionary dictionaryWithContentsOfFile:localizedPath];



plist = [NSPropertyListSerialization propertyListFromData:dic mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error];
if (!plist) {
    NSLog(@"Error reading plist from file '%s', error = '%s'", [localizedPath UTF8String], [error UTF8String]);
    [error release];
}

return plist;
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{

dict =[self readPlist:@"A"];
return dict.allKeys.count;
 }

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

dict = [self readPlist:@"A"];
 key = [dict.allKeys objectAtIndex:section];
return [[dict valueForKey:key] count];

}

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

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

  cell.textLabel.text = [[dict objectForKey:key] objectAtIndex:indexPath.row];

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-15T17:37:08+00:00Added an answer on June 15, 2026 at 5:37 pm

    UPDATE 2: You need to set the delegate and datasource for your tableView in your xib or ViewController.

    In your ViewController.h file

    @interface ViewController:UIViewController <UITableViewDelegate, UITableDataSource>
    

    Try this code which I have written for you.

    - (void)viewDidLoad {
    
        tableView.delegate = self;
        tableView.dataSource = self;
    
        NSString *path = [[NSBundle mainBundle] pathForResource:@"Filename" ofType:@"plist"];
        NSArray *contentArray = [NSArray arrayWithContentsOfFile:path];
        // Having outlet for tableArray variable.
        tableArray = [[NSMutableArray alloc]initWithArray:contentArray copyItems:YES];
    
        [super viewDidLoad];
        // Do any additional setup after loading the view from its nib.
    }
    
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return [tableArray count];
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
       // In your case dictionary contains strings with keys and values. The below line returns dictionary only. not array..
        NSDictionary *dictionary = [tableArray objectAtIndex:section];
        return dictionary.allKeys.count;
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *cellIdentifier = @"MyCell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier];
        }
        NSDictionary *dictionary = [tableArray objectAtIndex:indexPath.section];
        NSArray *keysArray = dictionary.allKeys;
        // This below line display the key in textLabel
        cell.textLabel.text = [keysArray objectAtIndex:indexPath.row];
        // Below line will display the value of a key in detailTextLabel.
        cell.detailTextLabel.text = [dictionary valueForKey:[keysArray objectAtIndex:indexPath.row]];
        return cell;
    }
    

    UPDATE 2: After I have seen your plist in my MAC, I have found out that we are working with array of dictionaries in your A.plist.

    enter image description here

    So I found there is a bug in our code itself. Not in the plist file and you can use your 8000 data plist too.. Its working too. I have checked out totally. Now you can get the above Code and start work with.

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

Sidebar

Related Questions

Possible Duplicate: Get image data in Javascript? Convert an image into binary data in
Possible Duplicate: Data transfer from JavaScript to PHP. How can i get the browser's
Possible Duplicate: How to get pixel data from a UIImage (Cocoa Touch) or CGImage
Possible Duplicate: I need a good way to get data from a thread to
Possible Duplicate: Java - Using Jena APi - Get data from RDF file I'm
Possible Duplicate: How to get pixel data from a UIImage (Cocoa Touch) or CGImage
Possible Duplicate: Getting detected data from the UITextView I have posted the same question
Possible Duplicate: I want to load the data from XML file and show in
Possible Duplicate: How do I split strings in J2ME? I have a String data
Possible Duplicate: How to get pixel data from a UIImage (Cocoa Touch) or CGImage

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.