저는 UITableView 설정과 약 3 개의 레코드로로드되었습니다. Interface Builder에서 UITableView의 높이는 단지 44 픽셀입니다. 각 행의 높이는 44 픽셀로 설정됩니다.내 UITableView가 올바른 인덱스 행으로 스크롤되지 않는 이유는 무엇입니까?
이것은 한 번에 하나의 행만 표시 할 수 있지만 드래그하여 새 행으로 스크롤 할 수 있음을 의미합니다. UITableView 너무 스크롤 된 가장 눈에 띄는 행을 너무 항상 표시 싶습니다.
나는 설정을 다음과 같은 코드가 있습니다 :
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
// Get the center of the UITableView bounds
CGPoint tableViewCenter = self.activeTableView.center;
// Get the row that is currently occupying the center point in the UITableView
NSIndexPath *row = [self.activeTableView indexPathForRowAtPoint:CGPointMake(tableViewCenter.x, tableViewCenter.y)];
// Animate and scroll to this row making it the only visible row.
[self.activeTableView scrollToRowAtIndexPath:row atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
내 문제를 내가 할 상관없이, 항상 스크롤 다시 1 행의 레코드 그것을. 제 3 행까지 계속 끌어 내려 놓을 수 있습니다. 그러면 첫 번째 레코드까지 계속 스크롤됩니다. 내가 놓은 후에 그것이 가장 눈에 보이는 행이라면 3 행을 스크롤하고 중앙에 넣어야하지 않습니까?
감사합니다.