NSDictionary

NSDictionary

  1 字典 存储的内存不是连续的  key value  

  2 初始化 

     NSDictionary *dict1 = [NSDictionary dictionaryWithObject

                        dictionaryWithObjects

     or

     NSdictionar *dict2 = {@"2":@"a",@"2":@"c"};

     两种初始化的方法键值对的顺序是相反的

   3 方法

      count

      valueForKey  objectForKey

      (NSArray)allValues 输出所有的值

      (NSArray)allKeys 输出所有的键

      objectForKey:  notFoundMarker:    如果没找打输出后面方法的内容

   4 遍历

      for(NSStirng *key:dict ){

      }

      //通过key来遍历字典

      NSEnumerator *en =[dict keyEnumerator]

      id key = nil;

      while( key = [en nextObject]){

        NSLog();

      }

原文地址:https://www.cnblogs.com/cooking/p/4916983.html