Note that there are some explanatory texts on larger screens.

plurals
  1. PONSDictionary within a NSDictionary
    primarykey
    data
    text
    <p>At the moment i've got the following code to get data from an xml file. This works so far</p> <pre><code>- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ currentElement = [elementName copy]; if ([elementName isEqualToString:@"Placemark"]) { placemarkData = [[NSMutableDictionary alloc] init]; currentTitle = [[NSMutableString alloc] init]; } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ if ([currentElement isEqualToString:@"name"]) [placemarkData addObject:string forKey:currentElement]; if ([currentElement isEqualToString:@"address"]) [placemarkData addObject:string forKey:currentElement]; if ([currentElement isEqualToString:@"coordinates"]) [placemarkData addObject:string forKey:currentElement]; } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ if ([elementName isEqualToString:@"Placemark"]) { [Placemarks addObject:[placemarkData copy]]; NSString *batsen = [placemarkData objectForKey:@"name"]; NSLog(@"adding story: %@", batsen); } } </code></pre> <p>This dictionary will be loaded into a array. Problem is that where this array got loaded in need to find the right entry in the array. I do it like this</p> <pre><code> TabbedCalculationAppDelegate *appDelegate = (TabbedCalculationAppDelegate *)[[UIApplication sharedApplication] delegate]; NSArray *jean = appDelegate.Placemarks; NSDictionary *boekje = [jean objectAtIndex:1]; NSString *coordinaten = [boekje objectForKey:@"coordinates"]; NSString *naam = [boekje objectForKey:@"name"]; NSLog(@"poep: %@" , naam); NSLog(@"wwhoppa: %@", coordinaten); titel.text = coordinaten; </code></pre> <p>But since arrays works with index I can't find a way to get the right entry. To clarify, a user clicks in a mapview on an annotation. This annotation then gets the corresponding detailview. The detailview can check which annotation is clicked by the view.annotation.title;</p> <p>So I actually need a dictionary in a dictionary with name as key in the root dictionary. Is this possible? and on what way I can implement this?</p> <p>Is this a little bit clear? Else just ask!</p> <p>Thnx guys</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload