dictionaryWithObjectsAndKeys:
Creates a dictionary containing entries constructed from the specified set of values and keys.
Declaration
+ (instancetype) dictionaryWithObjectsAndKeys:(id) firstObject;Parameters
- firstObject:
The first value to add to the new dictionary.
Discussion
After passing firstObj, pass a null-terminated list of alternating values and keys as variadic arguments. If any key is nil, an invalidArgumentException is raised.
This method is similar to dictionaryWithObjects:forKeys:, differing only in the way key-value pairs are specified.
For example:
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
@"value1", @"key1", @"value2", @"key2", nil];