핵심 데이터와 작동하는 앱이 있습니다. 데이터에는 날짜가있는 입력란이 있으며 나는 한 달의 모든 입력을 별도의 섹션에 표시하려고합니다.CoreData 및 UITableViewController 문제
데이터를 실제로 얻으려면 어떻게해야합니까? 나는 NSFetchedResultsController 데이터를 얻고 이것을 사용하는 데 사용 :
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
id <NSFetchedResultsSectionInfo> sectionInfo = [[_fetchedResultsController sections] objectAtIndex:section];
return [sectionInfo numberOfObjects];
}
은 행과 내용 :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
MyInfoObject *info = [_fetchedResultsController objectAtIndexPath:indexPath];
}
내 실제로 데이터 객체를 얻을 수 있습니다.
감사
당신은 당신이 가져온 결과 컨트롤러를 설정하는 방법에 대한 코드를 추가 할 수를 인스턴스화 할 때 sectionNameKeyPath을 설정해야합니다? 여기에서 섹션이 설정됩니다. –