NSFetchedResultsController가있는 코어 데이터 테이블에서 직접 데이터를로드하는 tableView가 있습니다. 반입 결과에서 객체를 저장하기 위해 중간 NSMutableArray를 사용하지 않습니다.테이블 뷰에 삽입 행 추가
기본적으로 내 UITableViewController 내에서 프로토콜 메서드 numberOfRowsInSection을 구현하고 NSFetchedResultsSectionInfo 내에 numberOfObjects를 반환합니다.
cell.textLabel.text = @"categoria";
I을 (합병증을 피하기 위해)를 fetchedResultController에서 객체 정보를 atIndexPath 및 검색하지만 지금 나는 어떤 객체에 대한 일반적인 구성이 :
id <NSFetchedResultsSectionInfo> sectionInfo = [[fetchedResultsController sections] objectAtIndex:section];
후 나는 configureCell를 구현하여 셀 내용을 구성 customSetEditing이라는 자체 선택기를로드하는 오른쪽에 사용자 정의 편집 버튼이있는 NavigationBar도 있습니다. 내가 달성하려고하는 것은 "셀 삽입"테이블 뷰의 시작 부분에로드하는 것이므로 탭하면 탭이 새로운 레코드를 만듭니다. 이 마지막 부분은 문제를 구현하기 쉽습니다. 탐색 막대를 편집 할 때 삽입 행이나 행을로드 할 수없는 것 같습니다.
- (void) customSetEditing {
[super setEditing:YES animated:YES];
[self.tableView setEditing:YES animated:YES];
[[self tableView] beginUpdates];
//[[self tableView] beginUpdates];
UIBarButtonItem *customDoneButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(customDone)];
[self.navigationItem.rightBarButtonItem release];
self.navigationItem.rightBarButtonItem = customDoneButtonItem;
//[categoriasArray insertObject:[NSNull null] atIndex:0];
NSMutableArray *indexPaths = [[NSMutableArray alloc] initWithObjects:[NSIndexPath indexPathForRow:0 inSection:0],nil ];
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
//[indexPaths release];
[self.tableView reloadData];}
를 추가하기 전에 :
이
내 customSetEditing 코드입니다[self.tableView reloadData];
를 나는 경계 부족 오류 플러스 프로그램이 다운 받고되었고 프로그램이 충돌하지 않지만 그것은 아무것도로드되지 않습니다.
나는 stackoverflow에서 비슷한 상황을 많이 보았습니다 (그런데 아주 유용한 도움을 주며 훌륭한 사람들과 훌륭한 토론장입니다). 아무도 예제가없는 것 같습니다.
아이디어가 있으십니까?