KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So I have a UITableView that represents a video library. The datasource of the library is a NSMutableDictionary that contains a NSMutableArray for each of its keys. Each of the Arrays contains an Array with all the info for each value. NSMutableDictionary -> Foreach Key a NSMutableArray that contains -> NSMutableArrays . tableSectionData is my datasource. I have been trying to insert a row on the first section and delete another row in another section. This is the code I am using: EDIT This is the new attempt. I first update the datasource and then add and delete the corresponding rows that are indexed with my dataSource. [mainTableView beginUpdates]; NSMutableDictionary *clone = [[NSMutableDictionary alloc] initWithDictionary:self.tableSectionData copyItems:YES]; for (NSString *key in [clone allKeys]) { if([key isEqualToString:@"Videos available for download"]) { for (NSArray *videoArray in [clone objectForKey:key]) { if ([[videoArray objectAtIndex:0] isEqualToString:helper.videoName]) { [[self.tableSectionData objectForKey:@"Downloaded videos"] addObject:videoArray]; NSUInteger insertIndex = [[self.tableSectionData objectForKey:@"Downloaded videos"] indexOfObject:videoArray]; NSIndexPath *pathToInsert = [NSIndexPath indexPathForRow:insertIndex inSection:0]; NSArray *indexesToAddition = [NSArray arrayWithObject:pathToInsert]; [mainTableView insertRowsAtIndexPaths:indexesToAddition
Tags (comma-separated)
Save Edits
Cancel