User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







objective-c:foundation.framework:nsdictionary.h:initwithobjectsandkeys

initWithObjectsAndKeys

 
- (instancetype)initWithObjectsAndKeys:(id)firstObject, (NSString*)firstKey, ...
 

Initializes a newly allocated dictionary with entries constructed from the specified set of values and keys.

Return Value - NSDictionary

Parameters - A null-terminated list of alternating values and keys.

firstObject - The first value to add to the new dictionary.

firstKey - The arbitrary key associated to the firstObject.

ObjC Sourcecode Example

    // ** Init dictionary with entries **
    NSDictionary *myDictionary = [[NSDictionary alloc]initWithObjectsAndKeys:@"value1", @"key1", @"value2", @"key2", nil];
 
    // ** Output dictionary **
    NSLog(@"myDictionary: %@", myDictionary);

Output for this example code

2014-05-30 21:12:31.118 NSDictionary[770:70b] myDictionary: {
    key1 = value1;
    key2 = value2;
}
advertising
objective-c/foundation.framework/nsdictionary.h/initwithobjectsandkeys.txt · Last modified: 2014/05/30 21:51 by Mo

Impressum Datenschutz