Questions tagged [nsdictionary]

A member of Apple's Objective-C framework Cocoa. NSDictionary objects manage associations of keys and values.

A member of Apple's Objective-C () framework Cocoa. NSDictionary objects manage associations of keys and values.

An instance of NSDictionary contains a set of keys and for each key an associated value.

Both keys and values must be objects. The keys must all be different from each other. Both keys and values cannot be nil.

Resources:

4108 questions
1
vote
1 answer

Create a dictionary of cities and states in order to store a string in UITableView

I'm creating a UITableView with a list of States and once you select a state in one of the cells it will switch to the next view that will have a list of cities that correspond to that State. This is what I have so far with my array of cities: -…
1
vote
2 answers

Core data. NSDictionary VS NSFetchRequest?

I have some data consists of records for 2 tables: pairs and items. These tables are linked with many-to-many relationships. I see 2 possble ways to fill core data entities. Let we have already filled all the items and now we should fill pairs. In…
1
vote
0 answers

CHOrderedDictionary keysAtIndexes unrecognized selector sent to instance

I have plist file and I am using CHDictionary to get them ordered. When I use "allKeys" to get the keys, there is no problem. Here is the sample: //1 NSString *pathListNames = [[NSBundle mainBundle] pathForResource:@"menuListNames"…
Reaper
  • 124
  • 2
  • 16
1
vote
2 answers

3 dimensional lookup dictionary for images?

Please help me construct a multidimensional lookup table, I want to get rid of the damned arrowhead anti pattern and not use ifs and switches at all. I have two UIControlStates UIControlStateNormal UIControlStateHighlighted two sides defined as…
Earl Grey
  • 7,426
  • 6
  • 39
  • 59
1
vote
1 answer

Extracting values from a dictionary the magic way

I have an array or dictionaries. The dictionaries and keys are like this: [@"Ford", @"brand", @"Fiesta", @"model", @"1980", @"year"] [@"Chevrolet", @"brand", @"Corvette", @"model", @"2000", @"year"] [@"Chrysler", @"brand", @"S…
Duck
  • 34,902
  • 47
  • 248
  • 470
1
vote
3 answers

Add NSNumber 0 to NSDictionary

I need to create a dictionary with for a search, based on IDs, but if no ID gets selected, 0 has to be stored. Now I can obviously do it like this: NSNumber* cityID; NSNumber* zoneID; //These two do get value, just showing for their…
Lord Zsolt
  • 6,492
  • 9
  • 46
  • 76
1
vote
1 answer

How to add objects from an NSDictionary to an NSArray for a UIActionSheet UIButton list

my dictionary myDictionary = [[publicDataCityArray valueForKey:@"data"] valueForKey:@"name"]; NSLog(@"myDictionary is %@ myDictionary count is %i", myDictionary, [myDictionary count]); NSLog output: myDictionary is ( Roma, …
user2588945
  • 1,681
  • 6
  • 25
  • 38
1
vote
1 answer

Does unarchiving an NSDictionary using NSKeyedUnarchiver alloc all the objects it contains?

In my app, for every game saved on a device I'm storing the game object in an NSDictionary along with some other meta data that gets archived with NSKeyedArchiver. I'm trying to avoid having to alloc/init the game object every time I want peak at…
Vanny
  • 259
  • 3
  • 8
1
vote
0 answers

initWithContentsOfURL: returns nil

i want to load a plist into a nsdictionary with this code: NSDictionary *data = [[NSDictionary alloc] initWithContentsOfURL:myUrl]; My Problem is that initWithContentsOfURL returns nil. Here's a cutted version of my plist:
bluerob
  • 91
  • 7
1
vote
2 answers

Cocoa: Any downside to using NSSet as key in NSMutableDictionary?

Is there any downside to using NSSet as key in NSMutableDictionary, any gotchas to be aware of, any huge performance hits? I think keys are copied in Cocoa containers, does it mean NSSet is copied to dictionary? Or is there some optimization that…
stefanB
  • 77,323
  • 27
  • 116
  • 141
1
vote
2 answers

Save large NSDictionary to disk iOS

My application is designed to view the catalog with products. All data received from the server (xml) are parsed in NSDictionary. So NSDictionary contains about 5000 items. Reading a dictionary using NSKeyedUnarchiver takes 24 seconds. It is…
maxibystro
  • 25
  • 1
  • 7
1
vote
1 answer

Converting Dictionary key values into NSNumber

I just successfully finished making my first JSON request and deserializing the information now all I need to do is know how to gather a few values from my dictionary. Here's what the request looks like: @implementation ViewController { …
1
vote
1 answer

is NSDictionary non-ordered completely

As we know,NSDictionary is non-ordered.however,when keys is number,when the dictionary is printed,they are printed by ascending number. i have try many times.
吴志坚
  • 29
  • 4
1
vote
2 answers

Efficient way of checking the content of every NSDictionary in NSArray

In my app I'me getting responses from the server and I have to check that I don't create duplicate objects in the NSArray which contains NSDictionaries. Now to check if the objects exists I do this: for (int i = 0; i <…
Sergey Grischyov
  • 11,995
  • 20
  • 81
  • 120
1
vote
1 answer

What fonts are guaranteed to be available on an iOS device?

I am wondering what fonts are guaranteed to be available on an iOS device. I used this and it works fine: [[UITabBarItem appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor grayColor], …
GRW
  • 605
  • 12
  • 27
1 2 3
99
100