数组新添加法

来源:互联网 发布:制订淘宝规则目的 编辑:程序博客网 时间:2024/05/22 16:05

一、数组新添加法

NSMutableArray  *mArray = [NSMutableArray new];

for (int i =0; i <3; i ++) {

    [mArray addObject:@[@"one",@"tow",@"three"][i]];

}


输出mArray@"one",@"tow",@"three"


二、JSON取数据 valueForKeyPath

NSDictionary *tempDict = @{@"expand3":@{@"res":@{@"time":@"2013-10-31"}}};

NSLog(@"time = %@",[tempDict valueForKeyPath:@"expand3.res.time"]);


输出  time = 2013-10-31