如何在 objective c 中将多个 NSDictionaries 添加到 NSArray?
How to Add Multiple NSDictionaries to NSArray in objective c?
这里我取了单个字典并将其添加到数组中,现在如何处理多个字典?
[self.dict setObject:_firstNameText.text forKey:@"FirstName"];
[self.dict setObject:_lastNameText.text forKey:@"LastName"];
[self.dict setObject:_ageText.text forKey:@"Age"];
[self.dict setObject:_emailText.text forKey:@"Email"];
[self.dict setObject:_mobileNumberText.text forKey:@"MobileNumber"];
NSLog(@"%@:",_dict);
[self.arr addObject:self.dict];
NSLog(@"%@:",_arr );
你的问题没问题
您应该首先使用 NSMutableArray
。比起每个 NSDictionaries
你必须 addObject
[mutableArray addObject:Dictionary];
[mutableArray addObjects:@"here array of dictionaries"];
干杯
这里我取了单个字典并将其添加到数组中,现在如何处理多个字典?
[self.dict setObject:_firstNameText.text forKey:@"FirstName"];
[self.dict setObject:_lastNameText.text forKey:@"LastName"];
[self.dict setObject:_ageText.text forKey:@"Age"];
[self.dict setObject:_emailText.text forKey:@"Email"];
[self.dict setObject:_mobileNumberText.text forKey:@"MobileNumber"];
NSLog(@"%@:",_dict);
[self.arr addObject:self.dict];
NSLog(@"%@:",_arr );
你的问题没问题
您应该首先使用 NSMutableArray
。比起每个 NSDictionaries
addObject
[mutableArray addObject:Dictionary];
[mutableArray addObjects:@"here array of dictionaries"];
干杯