Created
August 22, 2014 06:46
-
-
Save pilgwon/80626209e21099894957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(scrollView.tag == 200) { | |
int page = floor(scrollView.contentOffset.x / kSlideImageWidth); | |
float hRatio = (scrollView.contentOffset.x - kSlideImageWidth * page) / kSlideImageWidth; | |
if(page == [placeImageList count]-1) return; | |
NSDictionary *currentImageInfo = [placeImageList objectAtIndex:page]; | |
NSDictionary *nextImageInfo = [placeImageList objectAtIndex:page+1]; | |
float currentHeight = [[currentImageInfo objectForKey:@"height"] floatValue] / [[currentImageInfo objectForKey:@"width"] floatValue] * kSlideImageWidth; | |
float nextHeight = [[nextImageInfo objectForKey:@"height"] floatValue] / [[nextImageInfo objectForKey:@"width"] floatValue] * kSlideImageWidth; | |
float newHeight = currentHeight + (nextHeight - currentHeight) * hRatio; | |
[scrollView setFrame:CGRectMake(0, 0, kSlideImageWidth, newHeight)]; | |
[detailView setFrame:CGRectMake(0, newHeight + 10, detailView.width, detailView.height)]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment