-1

I work on a project in which you can let display RSS feeds in a UITableView. When tapping on it will be forwarded to a UIViewController (detailView). My problem is I'm not very familiar with NSDictionary. I've been a little reading about it, but don't understand it correctly.

Some information for my dict:

[@"name"]
[@"title"]
[@"link"]
[@"pubDate"]
[@"description"]

I use the style Subtitle in my cells. I do not know if it's relevant but the description has signs about 4000. Is this a problem?

This is the information that I want to store.

EDIT: to reduce misunderstandings so I post here again code

    Parser *parser = [[Parser alloc] initWithContentsOfURL:url];
    parser.rowElementName = @"item";
    parser.elementNames = @[@"title", @"link", @"pubDate", @"description"];
//    parser.attributeNames = @[@"img src="];
    [parser parse];
CTSchmidt
  • 1,155
  • 3
  • 17
  • 30

2 Answers2

0

Take a look at this question here. If you're really just looking for a short and quick example of NSDictionary usage, it sounds like what you want.

For future reference, post some examples of what you've tried and go over the NSDictionary Class Reference, they're always great starting points.

Community
  • 1
  • 1
JMarsh
  • 934
  • 7
  • 19
  • its looks really good i i read it before I was asking my question but i still don't now how i get the RSS data into that dict (NSXMLParser isn't a problem) I think it's just a simple code I'm looking for. – CTSchmidt Feb 20 '13 at 15:35
  • 1
    Right, well I see you're trying to display an RSS feed inside of a UITableView. I'd recommend taking a look at [MWFeedParser](https://github.com/mwaterfall/MWFeedParser). It's incredibly easy to use and there are a ton of examples on how to do exactly what you're asking. – JMarsh Feb 20 '13 at 15:41
  • Wow thats thats nice! Thank you! – CTSchmidt Feb 20 '13 at 15:48
0

To set values for something in a dictionary:

NSDictionary *myDictionary;
[myDictionary setObject:@"GeneralMike" forKey:"name"];
[myDictionary setObject:@"Most Awesome Master of Everything" forKey:"title"];

To get the values back out:

myNameLabel.text = [myDictionary objectForKey:@"name"];
myTitleLabel.text = [myDictionary objectForKey:@"title"];

Here I put the strings into a label, what you actually assign them to will depend on the type of the object and what you are trying to do. The point is just make sure you are putting whatever to are getting out into something or using it somehow.

GeneralMike
  • 2,951
  • 3
  • 28
  • 56