Skip to content

Instantly share code, notes, and snippets.

@codeOfRobin
Created April 1, 2015 18:14
Show Gist options
  • Save codeOfRobin/d479788af4f72f5ceb2b to your computer and use it in GitHub Desktop.
Save codeOfRobin/d479788af4f72f5ceb2b to your computer and use it in GitHub Desktop.
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
UIImageView *img=(UIImageView *)[self.view viewWithTag:2];
CGFloat y=-scrollView.contentOffset.y;
if (y>0)
{
[img setFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame)+y*CGRectGetWidth(self.view.frame)/330,y+330 )];
[img setCenter:CGPointMake(self.view.center.x, img.center.y)];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment