滑动视图【UIScrollView】及pageController

农飞尘
2023-12-01

//内容区域

@property(nonatomic) CGSize contentSize;

//偏移

@property(nonatomic) CGPoint contentOffset;

//弹簧效果

@property(nonatomic) BOOL bounces;

//允许滑动视图本身,如果设为no只能通过函数滑动,不能直接用手滑动

@property(nonatomic,getter=isScrollEnabled) BOOL scrollEnabled;

//显示水平进度条

@property(nonatomic) BOOL showsHorizontalScrollIndicator;

//显示垂直进度条

@property(nonatomic) BOOL showsVerticalScrollIndicator;


//分页效果

@property(nonatomic,getter=isPagingEnabled) BOOL pagingEnabled;


//放大和缩小的倍数(需要实现缩放的代理方法)

@property(nonatomic) CGFloat minimumZoomScale;

@property(nonatomic) CGFloat maximumZoomScale;


//带动画设置偏移

- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;



UIScrollViewDelegate

//代理方法

//滑动过程中

- (void)scrollViewDidScroll:(UIScrollView *)scrollView;

//开始拖动

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;

//停止拖动

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;

//开始滑动

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;

//停止滑动

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; 


//允许缩放的视图(一个scrollview中只能有一个可以缩放且必须设置可以缩放的位数)

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;



UIPageControl

//小点点

@property(nonatomic) NSInteger numberOfPages;

@property(nonatomic) NSInteger currentPage;


//小点点的颜色

@property(nonatomic,retain) UIColor *pageIndicatorTintColor;

@property(nonatomic,retain) UIColor *currentPageIndicatorTintColor;


 类似资料: