User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







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

init

 
- (instancetype)init
 

Initializes a newly allocated dictionary.

Return Value - NSDictionary

ObjC Sourcecode Example

    // ** Init dictionary **
    NSDictionary *myDictionary = [[NSDictionary alloc]init];
 
    // ** Output dictionary **
    NSLog(@"myDictionary: %@", myDictionary);

If you look at the output for this example code, you`ll see that an empty dictionary was initialized! Because this dictionary is immutable it would make more sense to use a init-method that creates it with some entries or at least one entry. For example initWithObjectsAndKeys.

Output for this example code

2014-05-30 20:44:47.577 NSDictionary[720:70b] myDictionary: {
}
advertising
objective-c/foundation.framework/nsdictionary.h/init.txt · Last modified: 2014/05/30 21:52 by Mo

Impressum Datenschutz