NSMutableDictionary可变字典 容量自动增加
2015-12-20 21:08 AB小博客 阅读(339) 评论(0) 编辑 收藏 举报// // main.m // NSMutableDIctionary // // Created by MAC on 15/12/20. // Copyright © 2015年 MAC. All rights reserved. // #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { //继承NSDictionary NSMutableDictionary *mdict = [NSMutableDictionary dictionaryWithCapacity:10]; [mdict setObject:@"ios" forKey:@"1"]; [mdict setObject:@"Android" forKey:@"2"]; [mdict setObject:@"cocos2dx" forKey:@"3"]; NSLog(@"%@",mdict); //删除 //[mdict removeObjectForKey:@"2"]; NSLog(@"%@",mdict); NSLog(@"%@", [mdict objectForKey:@"2"]); NSArray *array1 = @[@"a",@"b",@"c"]; NSArray *value = @[@"淘宝",@"京东",@"苏宁易购"]; mdict = [NSMutableDictionary dictionaryWithObjects:value forKeys:array1]; //删除一段value [mdict removeObjectsForKeys:@[@"2",@"3"]]; NSLog(@"%@",mdict); } return 0; }