从字典数组中,创建包含一个键的值的数组
我有一系列字典。我想提取一个数组,其中包含原始数组中字典的一个特定键的所有元素。不用枚举就可以做到这一点吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我有一系列字典。我想提取一个数组,其中包含原始数组中字典的一个特定键的所有元素。不用枚举就可以做到这一点吗?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
是的,使用 NSArray
-valueForKey:
方法。Yes, use the NSArray
-valueForKey:
method.是的,只需使用键值编码来询问键的值:
Yes, just use Key-Value Coding to ask for the values of the key: