日付でいっぱいのテーブルビューがあります。私のセクションヘッダーは月の名前です。ここで私のテーブルビューを見ることができます。
私が欲しいのは、その瞬間の月のセクションにスクロールすることです。セクションヘッダーの設定には、このメソッドを使用します。
id <NSFetchedResultsSectionInfo> theSection = [[self.fetchedResultsController sections] objectAtIndex:section];
static NSArray *monthSymbols = nil;
NSArray *dutchMonths = [[NSArray alloc]initWithObjects:@"Januari",@"Februari",@"Maart",@"April",@"Mei",@"Juni",@"Juli",@"Augustus",@"September",@"Oktober",@"November",@"December", nil];
if (!monthSymbols) {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setCalendar:[NSCalendar currentCalendar]];
[formatter setMonthSymbols:dutchMonths];
monthSymbols = [formatter monthSymbols];
}
NSLog(@"%@",monthSymbols);
NSInteger numericSection = [[theSection name] integerValue];
NSInteger year = numericSection / 1000;
NSInteger month = numericSection - (year * 1000);
NSString *titleString = [NSString stringWithFormat:@"%@", [monthSymbols objectAtIndex:month-1]];
label.text = titleString;
私はこの方法を使わなければならないことをすでに知っています。
[sampleListTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
しかし、正しい行のインデックスパスを取得するにはどうすればよいですか?
何か助けはありますか?詳細が必要な場合。助けてください。
敬具。