#import "ViewController.h"
@interface Viewcontroller ()
@property (Weak, nonatomic) Iboutlet Uiscrollview *scrollview;
@property (Weak, nonatomic) Iboutlet Uiimageview *minionview;
-(ibaction) scroll;
@end
@implementation Viewcontroller
-(void) viewdidload{
[Super Viewdidload];
Set the size of the ScrollView content (scrolling range)
Self.scrollView.contentSize = Cgsizemake (892, 480);
Self.scrollView.contentSize = self.minionView.image.size;
Scope of the overall content (scrolling range)
self.scrollView.contentSize = self.minionView.frame.size;
< #CGFloat Top#>, < #CGFloat Left#>, < #CGFloat Bottom#>, < #CGFloat right#>
Self.scrollView.contentInset = Uiedgeinsetsmake (ten , +, +);
Self.scrollView.frame.size; Visual Range
}
-(ibaction) Scroll {
[UIView animatewithduration:1.0 animations:^{
Self.scrollView.contentOffset = cgpointmake (100, 0);
// }];
Cgpoint offset = cgpointmake (-100,-100);
cgpoint offset = self.scrollView.contentOffset;
Offset.x + = 10;
Offset.y + = 10;
[Self.scrollview Setcontentoffset:offset Animated:yes];
}
@end
Simple Himalaya Interface Code
@interface Viewcontroller ()
@property (Weak, nonatomic) Iboutlet Uiscrollview *scrollview;
@property (Weak, nonatomic) Iboutlet UIButton *lastbtn;
@end
@implementation Viewcontroller
-(void) viewdidload{
[Super Viewdidload];
Set Content Size
CGFloat contenth = self.lastbtn.frame.origin.y + self.lastbtn.frame.size.height+ 10;
10 is the spacing at the bottom
cgfloat contenth = Cgrectgetmaxy (self.lastBtn.frame) + ten;
self.scrollView.contentSize = Cgsizemake (0, Contenth);
Add additional scrolling area (add 64 to the top of the area and add 44 to the bottom)
Self.scrollView.contentInset = Uiedgeinsetsmake (64, 0, 44, 0);
Set the start scroll position (scroll down 64)
Self.scrollView.contentOffset = Cgpointmake (0,-64);
}
@end
The use of IOS-Uiscrollview basic Properties (Contentsize, Contentinset, Contentoffset)