Ios elastic head, ios elastic
I haven't written a blog for a long time. Jin Tian has a little time to write it down. He always thinks that the elastic head is very dazzling. It looks tall and easy to write.
Hierarchical Analysis
There are a total of three layers, the bottom is the image layer, the middle is scrollView or its subclass, the top is the view added on scrollView
Main Code
ScrollView proxy method
-(Void) scrollViewDidScroll :( UIScrollView *) scrollView {NSLog (@ "% @", NSStringFromCGPoint (scrollView. contentOffset); if (scrollView. contentOffset. y <= 0) {self. imageView. frame = CGRectMake (scrollView. contentOffset. y * ScreenWith/200)/2, 0, ScreenWith-scrollView. contentOffset. y * ScreenWith/200,200 -scrollView.contentOffset.y);} else {[scrollView setContentOffset: CGPointMake (scrollView. contentOffset. x, 0)] ;}}
You can change the size of the Image view by changing the offset of scrollView sliding ~, Because it is very simple, no code will be pasted ~
Dynamic Graph: