views:

59

answers:

1

In a Tabbar app, I have a TableView to show all names of each dictionary of an array coming from an array like this :

<array>
<dict>
 <key>Name</key>
 <string>Name1</string>
 <key>CategoryA</key>
 <string>CategoryA1</string>
 <key>CategoryB</key>
 <string>CategoryB4</string>
 <key>CategoryC</key>
 <string>CategoryC8</string>
</dict>
<dict>
 <key>Name</key>
 <string>Name2</string>
 <key>CategoryA</key>
 <string>CategoryA1</string>
 <key>CategoryB</key>
 <string>CategoryB1</string>
 <key>CategoryB</key>
 <string>CategoryB2</string>
</dict></array>

No problem for that. But I would like to have an other tab with a TableView that give first the list of the categoryA. For That I made it like it :

       NSString *path = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"];  
 NSArray* plistData = [NSArray arrayWithContentsOfFile:path];

 NSMutableArray* array = [[NSMutableArray alloc] init];
 for(NSDictionary* dic in plistData)
 {
  NSString* contCatA = [dic objectForKey:@"CategoryA"];
  if (![array containsObject:contName]) [array addObject:contCatA];
 }
 self.arrayCategoryA = array;
 [array release];

Like this, I obtain a short list with only one of each element of CategoryA.

Here comes my trouble : I would like to go from this tableView to an other that shows only the elements with the key "Name" of the selected categoryA. Nothing I tried do what I expect.

Thx for your help

A: 

Hi !

I'm beginner and I try to understand... HOW I can make a request to show all data (from plist) in SAME category (NOT ALL !) for exemple : show only the movie have : genre = Action

Please help me ... Thanks a lot ! Excuse my bad english !

Is it in this code I must make it or an other ???

  • (id)initWithLibraryName:(NSString *)libraryName { if (self = [super init]) { libraryPlist = libraryName; libraryContent = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:libraryPlist ofType:@"plist"]];
Fraise