* : '섹션 0으로 행 0을 삽입하려고하지만 업데이트 이후 섹션 0 만 0 행이'나는 실현insertRowsatIndexPath 예외로 인해 캐치되지 않는 예외 'NSInternalInconsistencyException'응용 프로그램 종료, 이유는 아이폰 OS
가 여기에 문제는 내가 tableView에 셀을 추가하려고하지만 그것은 하나를 추가하지 않으며 싶지 않아 이유를 알아낼 수 없다는 것입니다.
- (IBAction)addNewIngredient: (id) sender
{
NSString *newIngredient = [recipe createIngredient];
[[recipe ingredients]addObject:newIngredient];
//figure out where that item is in the array
int lastRow = [[recipe ingredients]indexOfObject: newIngredient];
NSIndexPath *ip = [NSIndexPath indexPathForRow:lastRow inSection:0];
NSLog(@"Added a new ingredient!");
[[self tableView] insertRowsAtIndexPaths:[NSArray arrayWithObject:ip] withRowAnimation:
UITableViewRowAnimationTop];
}
내가 여기 할 노력하고있어 명확히하기 :
조리법 NSStrings의 배열 속성 재료를 가지고있다. 성분 배열에 객체를 추가하려고합니다 (배열 수를 자동으로 늘리거나 수동으로해야합니까?) ...
그런 다음 해당 항목이 배열에 " int lastRow = [[recipe ingredients] indexOfObject : newIngredient] " 그런 다음 가리 키도록 인덱스 경로를 가져옵니다. 해당 재료를 tableView에 삽입합니다.
을 반환하도록 그 당시
는, 데이터를 업데이트해야? 그것이 존재합니까? – Wain