0

需要知道将一个内容复制NSMutableDictionary到另一个的最佳方法NSMutableDictionary

我有大约 10 个类别,每个类别都有自己的列表:

在此处输入图像描述

我有一个UITableView使用称为listContent它的类成员datasource

@property (nonatomic) NSMutableDictionary *listContent;

然后我需要将 listContent 的内容保存到另一个列表中:

//Cached list results
@property (nonatomic) NSMutableDictionary *listContentCategory1;
@property (nonatomic) NSMutableDictionary *listContentCategory2;
@property (nonatomic) NSMutableDictionary *listContentCategory3;

这是为了节省获取先前获取的结果的开销。

简单地做self.listContentCategory1 = self.listContent;就是不复制self.listContentinto的当前内容self.listContentCategory1

我应该使用(nonatomic,copy), 在self.listContentCategory1,self.listContentCategory2?

(1) 我应该如何设置我的属性self.listContentself.listContentCategoy1,self.listContentCategoy2,etc?

(2) 作业的最佳方式?

谢谢!

4

1 回答 1

1
self.listContentCategory1 = [NSMutableDictionary dictionaryWithDictionary: Self.listContent];

使属性(非原子,保留)

于 2012-08-21T16:28:04.987 回答