ios - Clear NSMutableArray -
I want to store dateArray in internalElement and then clear dateArray when it starts for loop, I have new in dateair The data is there. Currently I am trying to use [dateArray clearAllobjects] to delete the data, but when I do this, it cleanses the internal element, is there a better way of doing this or what I can not find Thanks in advance for your help.
NSMutableArray * dateArray = [[nmutab and other] init]; InternalElement = [[NSMutableDictionary alloc] init]; (For object PFObject * object) {newDate = object [@ "date"]; If ([old date is: @ ""]) {NSMutableArray * transactionDetails = [[NSMutableArray alloc] init]; [TransactionDetails addObject: Object [@ "zodiac"]]; [TransactionDetails addObject: Object [@ "memo"]]; [TransactionDetails addObject: Object [@ "class"] [@ "name"]]; [Add Date Array Object: Transaction Details]; OldDate = Item [@ "Date"]; } And if ([New Data: Old Date]) {NSMutableArray * transactionDetails = [[NSMutableArray alloc] init]; [TransactionDetails addObject: Object [@ "zodiac"]]; [TransactionDetails addObject: Object [@ "memo"]]; [TransactionDetails addObject: Object [@ "class"] [@ "name"]]; OldDate = Item [@ "Date"]; } And {{internal element set object: dateire foreke: old date}; NSLog (@ "Date Array% @", Internal Element); [Date Array removed All Object]; NSLog (@ "Date Array% @", Internal Element); NSMutableArray * transactionDetails = [[NSMutableArray alloc] init]; [TransactionDetails addObject: Object [@ "zodiac"]]; [TransactionDetails addObject: Object [@ "memo"]]; [TransactionDetails addObject: Object [@ "class"] [@ "name"]]; [Add Date Array Object: Transaction Details]; // [transactionDetails removeAllObjects]; OldDate = Item [@ "Date"]; } [Internal element set object: object [@ "date"]: @ "date"]; [Internal Element Set Object: Object [@ "zodiac"]: @ "zodiac"]; [TransactionArray addObject: internalElement]; }
How this object pointer works
Consider the following "real world" pseudo-code example:
One classroom teacher wants to move from one side of the room to another group of books. She wants to include all children, so she prepares a plan, where each child will take some free books.
Your method:
1. Teachers raised all the children. 2. Teachers first pull the child towards him. Let's call him Timmy. 3. The teacher ensures that Timmy is not taking a handful of books 4. The teacher gives a handful of books to Timmy 5. The teacher asks Timmy to stand on his left side. 6. Repeat steps 3-5 for each member of the class.
Since the teacher has received the child only once, it always spoils Timmy.
Correct way:
1. Teachers raised all the children. 2. Teachers first pull the child towards him. 3. The teacher ensures that children are not taking a handful of books. 4. The teacher gives a handful of books to the child. 5. The teacher says that the child should stand on his left side. 6. Repeat the steps 2-5 for each member of the class.
To fix your source, exchange these two rows:
internalElement = [[NSMutableDictionary Alloc] init]; (PFObject * object in the objects) {{ as:
for (Object in PFObject * object) {internalElement = [[NSMutableDictionary Alloc] init];
Comments
Post a Comment