Permalink
Browse files

Merge pull request #748 from facebook/fix-scrollview-offset-restore

Fix scrollview offset restore
  • Loading branch information...
2 parents 2a6ee05 + bacba7a commit 0ebd67578f5783f49a59af051751e0bd54fc7072 Adar Porat committed Jan 13, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/Three20UI/Sources/TTTableViewController.m
@@ -327,7 +327,8 @@ - (BOOL)persistView:(NSMutableDictionary*)state {
- (void)restoreView:(NSDictionary*)state {
CGFloat scrollY = [[state objectForKey:@"scrollOffsetY"] floatValue];
if (scrollY) {
- CGFloat maxY = _tableView.contentSize.height - _tableView.height;
+ //set to 0 if contentSize is smaller than the tableView.height
+ CGFloat maxY = MAX(0, _tableView.contentSize.height - _tableView.height);
if (scrollY <= maxY) {
_tableView.contentOffset = CGPointMake(0, scrollY);

0 comments on commit 0ebd675

Please sign in to comment.