This shows you the differences between two versions of the page.
objective-c:foundation.framework:nsdictionary.h:init [2014/05/30 20:59] Mo created |
objective-c:foundation.framework:nsdictionary.h:init [2024/02/16 01:12] (current) |
||
---|---|---|---|
Line 17: | Line 17: | ||
<code objc> | <code objc> | ||
- | // ** Init dictionary | + | // ** Init dictionary ** |
NSDictionary *myDictionary = [[NSDictionary alloc]init]; | NSDictionary *myDictionary = [[NSDictionary alloc]init]; | ||
- | // ** Output dictionary | + | // ** Output dictionary ** |
NSLog(@"myDictionary: %@", myDictionary); | NSLog(@"myDictionary: %@", myDictionary); | ||
</code> | </code> | ||
- | 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". | + | 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 [[objective-c:foundation.framework:nsdictionary.h:initwithobjectsandkeys|]]. |
==== Output for this example code ==== | ==== Output for this example code ==== |