Skip to content

Commit

Permalink
Adjustment to tap behavior property name.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryhjones committed Sep 3, 2013
1 parent 3efd541 commit 46c87e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion SMPageControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ typedef NS_ENUM(NSUInteger, SMPageControlVerticalAlignment) {
SMPageControlVerticalAlignmentBottom
};

typedef NS_ENUM(NSUInteger, SMPageControlTapBehavior) {
SMPageControlTapBehaviorStep = 1,
SMPageControlTapBehaviorJump
};

@interface SMPageControl : UIControl

@property (nonatomic) NSInteger numberOfPages;
Expand All @@ -38,7 +43,7 @@ typedef NS_ENUM(NSUInteger, SMPageControlVerticalAlignment) {
@property (nonatomic) BOOL hidesForSinglePage; // hide the the indicator if there is only one page. default is NO
@property (nonatomic) BOOL defersCurrentPageDisplay; // if set, clicking to a new page won't update the currently displayed page until -updateCurrentPageDisplay is called. default is NO

@property (nonatomic) BOOL individualPageTaps; // if set to True, taping individual indicators will change to that specified page, rather than simply incrementing or decrementing the values.
@property (nonatomic) SMPageControlTapBehavior tapBehavior; // SMPageControlTapBehaviorStep provides an increment/decrement behavior exactly like UIPageControl. SMPageControlTapBehaviorJump allows specific pages to be selected by tapping their respective indicator. Default is SMPageControlTapBehaviorStep

- (void)updateCurrentPageDisplay; // update page display to match the currentPage. ignored if defersCurrentPageDisplay is NO. setting the page value directly will update immediately

Expand Down
4 changes: 2 additions & 2 deletions SMPageControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ @implementation SMPageControl
- (void)_initialize
{
_numberOfPages = 0;
_individualPageTaps = NO;
_tapBehavior = SMPageControlTapBehaviorStep;

self.backgroundColor = [UIColor clearColor];
_measuredIndicatorWidth = DEFAULT_INDICATOR_WIDTH;
Expand Down Expand Up @@ -420,7 +420,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];

if (self.individualPageTaps) {
if (SMPageControlTapBehaviorStep == self.tapBehavior) {
__block NSInteger pageTouched = -1;
[self.pageRects enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
CGRect indicatorRect = [obj CGRectValue];
Expand Down

0 comments on commit 46c87e4

Please sign in to comment.