UIScrollView

- (void)viewDidLoad

{

    [super viewDidLoad];

    UIScrollView *scrollview=[[UIScrollView alloc] initWithFrame:[UIScreen mainScreen].bounds];

    

    scrollview.contentSize=CGSizeMake([UIScreen mainScreen].bounds.size.width*5, [UIScreen mainScreen].bounds.size.height);

    scrollview.pagingEnabled=YES;

    scrollview.backgroundColor=[[UIColor blueColor] colorWithAlphaComponent:0.5];

    [self.view addSubview:scrollview];

}

//scrollEnabled  是否开启滚动

//

//scrollsToTop  默认为YES,用户可以单击状态栏滚动至顶部

//

//bounces  默认为YES,当滚动至边界时还可以进一步滚动,松开时迅速弹回至原位

//

//directionalLockEnabled  如果为YES,仅可以同时在一个方向上滚动

//

//decelerationRate  在轻弹屏幕后,滚动的速度逐渐衰减,较低的值衰减越快

//

//showsHorizontalScrollIndicator、showsVerticalScrollIndicator  默认为YES,滚动时滚动指示条可见

//

//indicatorStyle  滚动条的样式(UIScrollViewIndicatorStyleBlack,UIScrollViewIndicatorStyleDefaultUIScrollViewIndicatorStyleWhite)

//

//contentInset  指定内容四周的余量(上 左 下 右的顺序)

//

//scrollIndicatorInsets  指定了滚动指示条在位置的切换

//

//contentOffset  内容的定位点,当前显示内容的左上角

原文地址:https://www.cnblogs.com/zhibin/p/4115998.html