Today a little inspired, thank you and Csdn's friends for their support. I will bring you a better article, today's last article about ScrollView to do an introductory introduction, I believe many friends have to wait, haha. Let's go to the topic below.
Create a new project:
#import "ViewController.h"
@interface viewcontroller ()
{
// storage ScrollView
uiscrollview *_sv;
}
@end
@implementation Viewcontroller
-(void) viewdidload {
[superviewdidload];
// Add first to ScrollView and then load imageview
//imageview is above ScrollView.
[selfcrestescrollview];
[selfcreateimageview];
}
// Create a scrolling view
-(void) Crestescrollview
{
uiscrollview *sv = [[uiscrollviewalloc] init];
// Set scrolling view display area (just delimit the area for ScrollView not and)
sv. Frame = CGRectMake ( a);
sv. BackgroundColor = [uicolorcyancolor];
// Set scrolling view content size (content size directly determines the display size of your view)
sv. contentsize = Cgsizemake (a);
// add additional display area
sv. Contentinset = Uiedgeinsetsmake ( a);
// activate bounce effect
sv. bounces = YES ;
// Set whether the scroll indicator bar is displayed
// Horizontal Direction
sv. Showshorizontalscrollindicator = YES ;
// Vertical Direction
sv. Showsverticalscrollindicator = YES ;
[self. View addsubview: SV];
_sv = SV;
}
// Create ImageView
-(void) Createimageview
{
uiimageview *imageview = [[uiimageviewalloc] Init ];
ImageView. Frame = _SV . bounds ;
ImageView. Image = [UIImageimagenamed:@ "02.jpg"];
[_svaddsubview: ImageView];
}
@end
I painted this picture by hand, is it interesting? Tomorrow is the new year, it will not be updated. Be reunited with your family, clean up and prepare dishes. Wish you all a good year, the next year must be better, haha.
About iOS ScrollView (Getting started)