1

私はしばらくの間、これに対する答えを見つけようとしてきました。

私はcoredataテーブルを持っています。そのテーブルからエンティティを選択すると、detailviewcontrollerにすべての情報を持つ詳細ビューがプッシュされます。

スワイプすると、詳細ビ​​ューが次のオブジェクトの詳細で更新されるだけです。この関数のチュートリアルまたはサンプル コードを見た人はいますか?

この部分的なチュートリアルを見つけましたが、パーツの説明が不足しているため、どこから始めればよいかわかりません: http://craigcoded.com/2010/10/05/accessing-nsfetchedresultscontroller-results-on-the -detail-view-of-a-uitableview/

これは、detailViewController ではなく、tableViewController に入れる必要があるようです。

前もって感謝します。マイケル

これには、次のデクリメント ロジックが含まれます。

NSUInteger rowIndex = [[self storyIndex] row];
NSUInteger sectionIndex = [[self storyIndex] section];

if (rowIndex > 0) {
 rowIndex--;
} else if (sectionIndex > 0) {
sectionIndex--;
rowIndex = [[[[fetchedResultsController sections] objectAtIndex:sectionIndex] objects] count] - 1;
}

storyIndex = [NSIndexPath indexPathForRow:rowIndex inSection:sectionIndex];

Story *story = [fetchedResultsController objectAtIndexPath:storyIndex];
[self setupToolbarForStory:story];
[storyView setStory:story];
[storyView setNeedsDisplay];

そして、このインクリメント ロジック:

NSUInteger rowIndex = [[self storyIndex] row];
NSUInteger sectionIndex = [[self storyIndex] section];

if (rowIndex < [[[[fetchedResultsController sections] objectAtIndex:sectionIndex] objects] count] - 1) {
 rowIndex++;
} else if (sectionIndex < [[fetchedResultsController sections] count] - 1) {
 sectionIndex++;
 rowIndex = 0;
}

storyIndex = [NSIndexPath indexPathForRow:rowIndex inSection:sectionIndex];

Story *story = [fetchedResultsController objectAtIndexPath:storyIndex];
[self setupToolbarForStory:story];
[storyView setStory:story];
[storyView setNeedsDisplay];
4

0 に答える 0