user1999892
user1999892

Reputation: 135

Looping NSMutableDictionary

I have some table columns in database say: office, hallName and floor. I have some set of values in this table. I need to fetch these values and view it on the tableview. So i need to use NSMutableDictionary with for loop to get all the values in database. Can someone pls give me some idea for looping this dictionary? Thanks

Upvotes: 2

Views: 143

Answers (2)

Chris Wagner
Chris Wagner

Reputation: 21013

Enumerating over NSDictionary is most effectively done using

[dictionary enumerateKeysAndObjectsWithOptions:NSEnumerationReverse usingBlock:^(id key, id obj, BOOL *stop) {

}

This way you get access to both the key and object in one simple shot.

Upvotes: 0

iAppDeveloper
iAppDeveloper

Reputation: 1088

This might help you

NSString *key;
for(key in someDictionary){
     NSLog(@"Key: %@, Value %@", key, [someDictionary objectForKey: key]);
}

Upvotes: 1

Related Questions