Home  >  Q&A  >  body text

ios - nsdictionary转nsarray,要求一对key--value转为nasty的一个元素

如题。比如 nsdictionary—— A:{b:1,c:2,d:3} 转成
nsarray —— {b:1,c:2,d:3}
我只能想到用for循环来实现
for(nsstring *str in [a allkeys]){
[b addObject:@{k:a[k]}];
}
有没有更简单的方法?

PHP中文网PHP中文网2741 days ago727

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:42:47

    For the map function in functional programming, you can try ReactiveCocoa, or if you use swift, the map function is built-in.

    reply
    0
  • Cancelreply