Skip to content

Instantly share code, notes, and snippets.

@badeen
Created September 4, 2012 15:10
Show Gist options
  • Save badeen/3622184 to your computer and use it in GitHub Desktop.
Save badeen/3622184 to your computer and use it in GitHub Desktop.
Resizing map view in table view header and resizing.
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGPoint contentOffset = scrollView.contentOffset;
UIView *header = self.tableView.tableHeaderView;
if (contentOffset.y <= 0.0f) {
header.frame = CGRectMake(CGRectGetMinX(header.frame), contentOffset.y, CGRectGetWidth(header.frame), CFY_DISCOVER_TABLE_HEADER_MIN_HEIGHT - contentOffset.y);
[self.mapView setCenterCoordinate:self.mapView.userLocation.coordinate animated:NO];
} else {
header.frame = CGRectMake(CGRectGetMinX(header.frame), 0.0f, CGRectGetWidth(header.frame), CFY_DISCOVER_TABLE_HEADER_MIN_HEIGHT);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment