XLCycleScrollView.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // XLCycleScrollView.h
  3. // CycleScrollViewDemo
  4. //
  5. // Created by xie liang on 9/14/12.
  6. // Copyright (c) 2012 xie liang. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "StyledPageControl.h"
  10. @protocol XLCycleScrollViewDelegate;
  11. @protocol XLCycleScrollViewDatasource;
  12. @interface XLCycleScrollView : UIView<UIScrollViewDelegate>
  13. {
  14. UIScrollView *_scrollView;
  15. StyledPageControl *_pageControl;
  16. id<XLCycleScrollViewDelegate> __unsafe_unretained _delegate;
  17. id<XLCycleScrollViewDatasource> __unsafe_unretained _datasource;
  18. NSInteger _totalPages;
  19. NSInteger _curPage;
  20. NSMutableArray *_curViews;
  21. }
  22. - (id)initWithFrame:(CGRect)frame pcRect:(CGRect)pcRect;
  23. @property (nonatomic,readonly) UIScrollView *scrollView;
  24. @property (nonatomic,readonly) StyledPageControl *pageControl;
  25. @property (nonatomic,assign) NSInteger currentPage;
  26. @property (nonatomic,assign,setter = setDataource:) id<XLCycleScrollViewDatasource> datasource;
  27. @property (nonatomic,assign,setter = setDelegate:) id<XLCycleScrollViewDelegate> delegate;
  28. - (void)reloadData;
  29. - (void)setViewContent:(UIView *)view atIndex:(NSInteger)index;
  30. @end
  31. @protocol XLCycleScrollViewDelegate <NSObject>
  32. @optional
  33. - (void)didClickPage:(XLCycleScrollView *)csView atIndex:(NSInteger)index;
  34. @end
  35. @protocol XLCycleScrollViewDatasource <NSObject>
  36. @required
  37. - (NSInteger)numberOfPages;
  38. - (UIView *)pageAtIndex:(NSInteger)index;
  39. @end