Я написал некоторый код для пакетного удаления / вставки разделов и ячеек из / в табличное представление.Но я столкнулся с проблемой, которую не могу понять.Мои коды следующие:
NSMutableArray *deleteIndexPaths = [[NSMutableArray alloc] initWithCapacity:1];
NSMutableArray *insertIndexPaths = [[NSMutableArray alloc] initWithCapacity:1];
NSIndexSet *insertSections = [[NSIndexSet alloc] initWithIndex:kDeleteSection];
NSArray *insertDeleteIndexPaths = [[NSArray alloc] initWithObjects:[NSIndexPath indexPathForRow:0 inSection:kDeleteSection], nil];
/// init deleteIndexPaths and insertIndexPaths
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationRight];
[self.tableView insertSections:insertSections withRowAnimation:UITableViewRowAnimationRight];
[self.tableView insertRowsAtIndexPaths:insertDeleteIndexPaths withRowAnimation:UITableViewRowAnimationRight];
[self.tableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
[insertSections release];
[deleteIndexPaths release];
//[insertSections release]; // If uncommented it, program will crash.
[insertDeleteIndexPaths release];
В качестве комментария к коду, если я раскомментирую оператор [insertSections release]; , программа завершится сбоем.Зачем?Я не могу найти ответ.