zoukankan      html  css  js  c++  java
  • [OC Foundation框架

     
     1 void dicUse()
     2 {
     3     NSMutableDictionary *dic = [NSMutableDictionary dictionary];
     4     Student *stu1 = [Student studentWithName:@"Simon"];
     5    
     6     NSLog(@"stu1:%zi", [stu1 retainCount]);
     7     [dic setObject:stu1 forKey:@"k1"];
     8     NSLog(@"stu1:%zi", [stu1 retainCount]);
     9    
    10     [dic setObject:[Student studentWithName:@"Joke"] forKey:@"k2"];
    11     NSLog(@"%@", dic);
    12    
    13     [dic removeObjectForKey:@"k1"];
    14     NSLog(@"after remove stu1:%zi", [stu1 retainCount]);
    15    
    16     NSMutableDictionary *dic2 = [NSMutableDictionary dictionary];
    17     [dic2 addEntriesFromDictionary:dic];
    18     NSLog(@"dic2: %@", dic2);
    19 }
     
    NSMutableDictionary不允许使用简化的集中初始化方法创建
    error:
    1         NSMutableDictionary *d11_1 = @{@"姓名":@"张三", @"年龄":@"21", @"性别":@""};
     
     
     
     
     
     
  • 相关阅读:
    数据库操作
    jquery 第一章
    算法很美 第一章
    python 学习第四天
    python学习第三天
    python学习第二天
    学习python的第一天
    C#-线程
    C#-流、存储
    C#-集合
  • 原文地址:https://www.cnblogs.com/hellovoidworld/p/4119414.html
Copyright © 2011-2022 走看看