我有一个NSMutableArray;
NSMutableArray
--NSMutableArray
----NSDictionary
----NSDictionary
----NSDictionary
--NSMutableArray
----NSDictionary
----NSDictionary
----NSDictionary
Run Code Online (Sandbox Code Playgroud)
我想将第一个NSDictionary移动到第二个NSMutableArray.这是代码:
id tempObject = [[tableData objectAtIndex:fromSection] objectAtIndex:indexOriginal];
[[tableData objectAtIndex:fromSection] removeObjectAtIndex:indexOriginal];
[[tableData objectAtIndex:toSection] insertObject:tempObject atIndex:indexNew];
Run Code Online (Sandbox Code Playgroud)
它删除了对象,但无法将对象插入新位置.错误是:
[CFDictionary retain]: message sent to deallocated instance 0x4c45110
Run Code Online (Sandbox Code Playgroud)
在头文件中:
NSMutableArray *tableData;
@property (nonatomic, retain) NSMutableArray *tableData;
Run Code Online (Sandbox Code Playgroud)
我如何重新排序/移动nsmutablearray中的对象?