调用deleteRowsAtIndexPaths:withRowAnimation:withRowAnimation:
后如果tableView:numberOfRowsInSection返回的行数不是删除前-1则会crash,同样删除最后一行导致numberOfSectionsInTableView返回值跟调用前不一样而crash。解决方法,调用deleteRowsAtIndexPaths:withRowAnimation:时判断是不是该section最后一行,如果时则同时调用deleteSections:indexSetWithIndex:withRowAnimation:
后如果tableView:numberOfRowsInSection返回的行数不是删除前-1则会crash,同样删除最后一行导致numberOfSectionsInTableView返回值跟调用前不一样而crash。解决方法,调用deleteRowsAtIndexPaths:withRowAnimation:时判断是不是该section最后一行,如果时则同时调用deleteSections:indexSetWithIndex:withRowAnimation: