CGRect sectionRect = [self.tableView rectForSection: sectionIndexForNewFolder];
// Try to get a full-height rect which is centred on the sectionRect
// This produces a very similar effect to UITableViewScrollPositionMiddle.
CGFloat extraHeightToAdd = sectionRect.size.height - self.tableView.frame.size.height;
sectionRect.origin.y -= extraHeightToAdd * 0.5f;
sectionRect.size.height += extraHeightToAdd;
[self.tableView scrollRectToVisible:sectionRect animated:YES];
// Try to get a full-height rect which is centred on the sectionRect
// This produces a very similar effect to UITableViewScrollPositionMiddle.
CGFloat extraHeightToAdd = sectionRect.size.height - self.tableView.frame.size.height;
sectionRect.origin.y -= extraHeightToAdd * 0.5f;
sectionRect.size.height += extraHeightToAdd;
[self.tableView scrollRectToVisible:sectionRect animated:YES];
No comments:
Post a Comment