테이블 뷰가 날짜로 채워져 있습니다. 내 섹션 헤더는 월 이름입니다. here 이상의 내 tableview를 볼 수 있습니다.테이블 뷰의 특정 포인트로 스크롤
내가 원하는 것은 그 순간의 해당 부분으로 스크롤된다는 것입니다. 내 섹션 헤더를 설정하기 위해이 메소드를 사용한다.
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];
그러나 올바른 행의 색인 경로를 얻으려면 어떻게해야합니까?
어떤 도움이 필요합니까? 더 자세한 정보가 필요하면. 도와주세요.
친절하게 제공합니다.
[self.fetchedResultsController indexPathForObject : object]는 모든 셀에 대한 indexpath를 찾는 방법입니다. – Sandeep