【发布时间】:2014-10-08 16:01:54
【问题描述】:
我查看了以下资源: NSDictionary to NSArray? https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html
我正在尝试将 NSDictionary 插入 NSMutableArray。
相关代码在我看来是这样的:
@property (strong,nonatomic) NSMutableArray * curveList;
@property (strong,nonatomic) UIBezierPath * curPath;
@property (strong, nonatomic) UIColor * curColor;
// some code to set curPath and curColor
@{@"path":_curPath, @"color":_curColor}
//how to insert this into self.curveList???
【问题讨论】:
-
查看
NSMutableArray的文档。添加对象有一个非常明显的方法。 -
您可以像添加任何其他对象一样添加 NSDictionary。
-
用 setObject:forKey: 方法?
-
我实际上指出我已经阅读了该资源......我发现它们不像最明显的那样有用。
-
我想这也应该被否决...stackoverflow.com/questions/1760371/…我不确定有些人明白为什么这个网站是必要的。如果文档足够多,这个网站就不会像今天这样存在了。
标签: ios objective-c xcode nsmutablearray nsdictionary