uiscrollview Bottom -level implementation: Modify bounds, equal to uiscrollview contentoffset offset #import "ViewController.h" @interface Viewcontroller () <uiscrollviewdelegate> @property(Nonatomic,Weak) UIView *scrollview;
@end
@implementation Viewcontroller
-(void) viewdidload { [Super Viewdidload]; UIView*scorllview = [[UIViewAlloc]initWithFrame:Self.View.Bounds];
[Self.ViewAddsubview: Scorllview];
_scrollview= Scorllview;
//Add toPanGesture
Uipangesturerecognizer*pan = [[UipangesturerecognizerAlloc]Initwithtarget:SelfAction:@selector(pan:)];
[ScorllviewAddgesturerecognizer:p an];
Uiswitch*switchview = [[UiswitchAlloc]Init];
[ScorllviewAddsubview: SwitchView];
1.UIViewAdd aPanGesture
2.Move your fingers upwards.,Content go up,Want to see the following content, bounds.y++
}
- (void) Pan: (Uipangesturerecognizer*) Pan
{
//Get finger Offset
CgpointTRANSP = [panTranslationinview:p an.View];
CGFloatOffsetY =-TRANSP.Y;
//ModifyBounds
CGRectBounds =_scrollview.Bounds;
Bounds.Origin.Y+ = OffsetY;
_scrollview.Bounds= bounds;
//Reset
[PanSettranslation:cgpointzero inview:p an. View];
//NSLog (@ "%f", OffsetY); }
//As soon as a scroll is called
- (void) Scrollviewdidscroll: (Uiscrollview*) ScrollView
{
NSLog(@"%@ %@",nsstringfromcgpoint(scrollView. Contentoffset),nsstringfromcgrect(scrollView. Bounds)); }// @end
02-uiscrollview Bottom-level implementation