PageScrollView.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // PageScrollView.h
  3. // CommonLibrary
  4. //
  5. // Created by Alexi Chen on 3/5/13.
  6. // Copyright (c) 2013 AlexiChen. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @class PageScrollView;
  10. @protocol PageScrollViewDelegate <NSObject>
  11. //- (void)onPageScrollView:(PageScrollView *)pageView scrollTransitionTo:(UIScrollView *)scrollView;
  12. - (void)onPageScrollView:(PageScrollView *)pageView scrollToPage:(NSInteger)pageIndex;
  13. @end
  14. @interface PageScrollView : UIView<UIScrollViewDelegate>
  15. {
  16. @protected
  17. CGPoint _startOffset;
  18. CGPoint _startPoint;
  19. CGPoint _endPoint;
  20. NSInteger _pageIndex;
  21. BOOL _pageControlUsed;
  22. UIPageControl *_pageControl;
  23. UIScrollView *_scrollView;
  24. NSMutableArray *_pages;
  25. __weak id<PageScrollViewDelegate> _pageScrollDelegate;
  26. }
  27. @property (nonatomic, strong) UIScrollView *scrollView;
  28. @property (nonatomic, strong) NSArray *pages;
  29. @property (nonatomic, weak) id<PageScrollViewDelegate> pageScrollDelegate;
  30. @property (nonatomic, readonly) UIPageControl *pageControl;
  31. @property (nonatomic, assign) NSInteger pageIndex;
  32. // 设置相应的内容并且重新布局
  33. - (void)setFrameAndLayout:(CGRect)rect withPages:(NSArray *)pages;
  34. - (void)scrollTo:(NSInteger)pageIndex;
  35. - (NSInteger)pageCount;
  36. - (void)changeToPage:(NSInteger)page manual:(BOOL)isManual;
  37. // protected method
  38. - (void)loadPage:(NSInteger)page feedBack:(BOOL)need;
  39. @end