From cc360cc06f2c8b065c134a778110613e37180c21 Mon Sep 17 00:00:00 2001 From: Looping Date: Sun, 2 Nov 2014 22:53:01 +0800 Subject: [PATCH] Change 'currentPageChanged' to 'currentPageChangedBlock' --- RCPageControl/RCPageControl.h | 2 +- RCPageControl/RCPageControl.m | 4 ++-- RCPageControlExample/RCPageControlExample/ViewController.m | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/RCPageControl/RCPageControl.h b/RCPageControl/RCPageControl.h index e579aa5..6f85664 100644 --- a/RCPageControl/RCPageControl.h +++ b/RCPageControl/RCPageControl.h @@ -60,7 +60,7 @@ typedef void (^RCCurrentPageChangedBlock)(RCPageControl *pageControl); @property(nonatomic) UIFont *currentPageIndexTextFont; // default is [UIFont systemFontOfSize:0], the font size is automatically adjusts by the value of indicatorDotWidth and animationScaleFactor -@property (nonatomic, copy) RCCurrentPageChangedBlock currentPageChanged; // if set, -sendActionsForControlEvents will never be called, only available for 'Touch Event' in page control, it also means you need to set non-zero frame for page control to activate 'Touch Event' +@property (nonatomic, copy) RCCurrentPageChangedBlock currentPageChangedBlock; // if set, -sendActionsForControlEvents will never be called, only available for 'Touch Event' in page control, it also means you need to set non-zero frame for page control to activate 'Touch Event' - (instancetype)initWithNumberOfPages:(NSInteger)pages; // if you want 'currentPageChanged' block available, call -setFrame: after initialization diff --git a/RCPageControl/RCPageControl.m b/RCPageControl/RCPageControl.m index 1a20691..c148309 100644 --- a/RCPageControl/RCPageControl.m +++ b/RCPageControl/RCPageControl.m @@ -261,8 +261,8 @@ [self setCurrentPage:self.currentPage + 1 forceRefresh:NO]; } - if (_currentPageChanged) { - _currentPageChanged(self); + if (_currentPageChangedBlock) { + _currentPageChangedBlock(self); } else { [self sendActionsForControlEvents:UIControlEventValueChanged]; } diff --git a/RCPageControlExample/RCPageControlExample/ViewController.m b/RCPageControlExample/RCPageControlExample/ViewController.m index 7f67b4b..12623a3 100644 --- a/RCPageControlExample/RCPageControlExample/ViewController.m +++ b/RCPageControlExample/RCPageControlExample/ViewController.m @@ -48,7 +48,7 @@ })]; __weak ViewController *weakSelf = self; - [_pageControlRC setCurrentPageChanged:^(RCPageControl *pageControl) { + [_pageControlRC setCurrentPageChangedBlock:^(RCPageControl *pageControl) { [weakSelf.pageViews scrollToItemAtIndex:pageControl.currentPage animated:YES]; }]; }