A long time did not write a blog, heaven a moment to write down, has always felt that the elastic head is very flashy, looks tall on, write up quite simple
Hierarchical analysis
For example, a total of 3 layers, the bottom is the image layer, the middle is scrollview or its sub-class, the top is scrollview above the added view
Main code
Proxy methods for ScrollView
- (void) Scrollviewdidscroll: (Uiscrollview *) ScrollView {NSLog (@"%@", Nsstringfromcgpoint (Scrollview.contentoffset)); if(scrollview.contentoffset.y<=0) {Self.imageView.frame= CGRectMake ((Scrollview.contentoffset.y *screenwith/ $)/2,0, Screenwith-scrollview.contentoffset.y *screenwith/ $, $-scrollview.contentoffset.y); }Else{[ScrollView setcontentoffset:cgpointmake (Scrollview.contentoffset.x,0)]; }}
Change the size of the picture view by changing the offset of the ScrollView sliding ok~, because it is very simple to not stick to the code ~
Dynamic graphs:
iOS Elastic head