我有一個簡單的代碼:以下分配類型之間的區別?
NSMutableArray *arrayCheckList = [[NSMutableArray alloc] init];
[arrayCheckList addObject:[NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"2011-03-14 10:25:59 +0000",@"Exercise at least 30mins/day",@"1",nil] forKeys:[NSArray arrayWithObjects:@"date",@"checkListData",@"status",nil]] ];
[arrayCheckList addObject:[NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"2011-03-14 10:25:59 +0000",@"Take regular insulin shots",@"1",nil] forKeys:[NSArray arrayWithObjects:@"date",@"checkListData",@"status",nil]]];
現在我想上面陣列的具體指標添加到字典中。下面是兩種方式,哪一種更好,爲什麼?後者的具體缺點是什麼?
NSDictionary *tempDict = [[NSDictionary alloc] initWithDictionary:[arrayCheckList objectAtIndex:1]];
OR
NSDictionary *tempDict = [arrayCheckList objectAtIndex:1];
什麼會在後者的影響,因爲我不是在做任何分配/初始化?