eck*_*ama -1 xcode objective-c nsdictionary nsmutablearray ios
我查看了以下资源: NSDictionary到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???
Run Code Online (Sandbox Code Playgroud)
您可以使用addObject方法将任何对象添加到NSMutableArray,如下所示:
NSDictionary *aDic= [NSDictionary dictionaryWithObjectsAndKeys:
@"Carlos", @"name",
@"Jimenez", @"lastName", nil];
//On initialization
NSMutableArray *aArr = [NSMutableArray arrayWithObjects:aDic,nil];
//After initialization
NSMutableArray *aArr2 = [NSMutableArray array]; [aArr2 addObject:aDic];
Run Code Online (Sandbox Code Playgroud)
希望它能帮到你!
| 归档时间: |
|
| 查看次数: |
8934 次 |
| 最近记录: |