Compare commits

..

No commits in common. "master" and "0.1" have entirely different histories.
master ... 0.1

25 changed files with 179 additions and 417 deletions

View File

@ -1,4 +0,0 @@
language: objective-c
before_install: gem update cocoapods && cd RCPageControlExample
script: xctool -workspace RCPageControlExample.xcworkspace -scheme RCPageControlExample -sdk iphonesimulator7.1 build

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2017 Looping
Copyright (c) 2014 RidgeCorn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,8 +0,0 @@
platform :ios, '7.0'
target 'RCPageControlExample' do
pod 'pop'
pod 'iCarousel'
end

View File

@ -1,15 +0,0 @@
PODS:
- iCarousel (1.8.3)
- pop (1.0.10)
DEPENDENCIES:
- iCarousel
- pop
SPEC CHECKSUMS:
iCarousel: d782f635afac190c49bb8ee455882284cff8b85f
pop: 82ca6b068ce9278fd350fd9dd09482a0ce9492e6
PODFILE CHECKSUM: 500e5f919d07fe70206af7b8761129a904c83b68
COCOAPODS: 1.2.1

View File

@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "RCPageControl"
s.version = "0.1.1"
s.summary = "Yet another page control for iOS, with awesome animation powered by facebook pop library."
s.version = "0.1"
s.summary = "Yet another page control for iOS, with awesome animation powered by facebook pop library and highly customizable UI."
s.homepage = "https://github.com/RidgeCorn/RCPageControl"
s.license = { :type => "MIT", :file => "LICENSE" }
s.authors = { "Looping" => "www.looping@gmail.com" }

View File

@ -1,15 +1,15 @@
//
// RCPageControl.h
// RCPageControl
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2017 Looping. All rights reserved.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
//
/**
The MIT License (MIT)
Copyright (c) 2017 Looping
Copyright (c) 2014 RidgeCorn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -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 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'
@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'
- (instancetype)initWithNumberOfPages:(NSInteger)pages; // if you want 'currentPageChanged' block available, call -setFrame: after initialization

View File

@ -1,26 +1,26 @@
//
// RCPageControl.m
// RCPageControl
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2017 Looping. All rights reserved.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
//
/**
The MIT License (MIT)
Copyright (c) 2017 Looping
Copyright (c) 2014 RidgeCorn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -31,7 +31,7 @@
*/
#import "RCPageControl.h"
#import <pop/POP.h>
#import <POP.h>
#define RCDefaultIndicatorDotBaseTag 1009
@ -48,15 +48,15 @@
#define RCDefaultIndicatorScaleAnimationKey @"RCPageControlIndicatorScaleAnimation"
#define RCDefaultIndicatorColorAnimationKey @"RCPageControlIndicatorColorAnimation"
#define RCDefaultIndicatorIndexLabelAlphaAnimationKey @"RCDefaultIndicatorIndexLabelAlphaAnimationKey"
#define IsFloatZero(A) (fabs(A) < FLT_EPSILON)
#define IsFloatZero(A) fabsf(A) < FLT_EPSILON
#define IsFloatEqualToFloat(A, B) IsFloatZero((A) - (B))
@interface RCPageControl ()
@property (nonatomic) NSInteger currentDisplayedPage;
@property (nonatomic) NSInteger previousDisplayPage;
@property (nonatomic) UILabel *indicatorIndexLabel;
@end
@ -72,70 +72,97 @@
if (self = [super initWithFrame:frame]) {
[self commConfig];
}
return self;
}
- (instancetype)initWithNumberOfPages:(NSInteger)pages {
RCPageControl *pageControl = [self init];
if (pageControl) {
[pageControl setNumberOfPages:pages];
}
return pageControl;
}
- (void)awakeFromNib {
[super awakeFromNib];
[self commConfig];
}
- (void)commConfig {
_currentDisplayedPage = 0;
_previousDisplayPage = 0;
_numberOfPages = 0;
_currentPage = 0;
_indicatorDotGap = 10.f;
_indicatorDotWidth = 4.f;
_animationSpeed = 8.f;
_animationBounciness = 12.f;
_animationDuration = .6f;
_animationScaleFactor = 2;
_hidesForSinglePage = NO;
_defersCurrentPageDisplay = NO;
_hideCurrentPageIndex = NO;
_disableAnimation = NO;
_pageIndicatorTintColor = [UIColor lightTextColor];
_currentPageIndicatorTintColor = [UIColor whiteColor];
_currentPageIndexTextTintColor = [UIColor darkTextColor];
_currentPageIndexTextFont = [UIFont systemFontOfSize:0];
[self loadIndicatorIndexLabel];
[self setBackgroundColor:[UIColor clearColor]];
}
- (void)loadIndicatorIndexLabel {
CGFloat width = MAX(RCDefaultIndicatorDotIndexDisplayMinWidth, [self _scaledDotMaxWidth]);
if (_indicatorIndexLabel) {
[_indicatorIndexLabel setFrame:CGRectMake(0, 0, width, width)];
} else {
_indicatorIndexLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, width)];
[_indicatorIndexLabel setTextAlignment:NSTextAlignmentCenter];
[_indicatorIndexLabel setBackgroundColor:[UIColor clearColor]];
}
[_indicatorIndexLabel setTextColor:_currentPageIndexTextTintColor];
[_indicatorIndexLabel setFont:[_currentPageIndexTextFont fontWithSize:[self _scaledDotMaxWidth] * 2 / 3]];
[_indicatorIndexLabel setHidden:_hideCurrentPageIndex];
UIView *dot = [self _currentDisplayedDot];
if (dot) {
[_indicatorIndexLabel setCenter:dot.center];
} else {
[_indicatorIndexLabel setHidden:YES];
}
}
#pragma mark - Properties
- (void)setNumberOfPages:(NSInteger)numberOfPages {
if (numberOfPages >= 0 && numberOfPages != _numberOfPages) {
_numberOfPages = numberOfPages;
[self _refreshIndicator:YES];
}
}
- (void)setCurrentPage:(NSInteger)currentPage forceRefresh:(BOOL)forceRefresh {
_previousDisplayPage = _currentPage;
_currentPage = MIN(MAX(0, currentPage), _numberOfPages - 1);
if ( !self.defersCurrentPageDisplay || forceRefresh) {
_currentDisplayedPage = _currentPage;
[self _animateIndicator:forceRefresh];
@ -148,20 +175,21 @@
- (void)setIndicatorDotGap:(CGFloat)indicatorDotGap {
CGFloat gap = MAX(RCDefaultIndicatorDotGapMinValue, indicatorDotGap);
if ( !IsFloatEqualToFloat(_indicatorDotGap, gap)) {
_indicatorDotGap = gap;
[self _refreshIndicator:YES];
}
}
- (void)setIndicatorDotWidth:(CGFloat)indicatorDotWidth {
CGFloat width = MAX(RCDefaultIndicatorDotWidthMinValue, indicatorDotWidth);
if ( !IsFloatEqualToFloat(_indicatorDotWidth, width)) {
_indicatorDotWidth = width;
[self loadIndicatorIndexLabel];
[self _refreshIndicator:YES];
}
}
@ -169,7 +197,8 @@
- (void)setAnimationScaleFactor:(NSInteger)animationScaleFactor {
if ( _animationScaleFactor != animationScaleFactor) {
_animationScaleFactor = MAX(RCDefaultIndicatorDotScaleFactorMinValue, animationScaleFactor);
[self loadIndicatorIndexLabel];
[self _dotScaleAnimationAtIndex:_currentDisplayedPage withProgress:RCDefaultIndicatorDotChangeProgressMaxValue];
}
}
@ -178,6 +207,8 @@
if ( !CGRectEqualToRect(self.frame, frame)) {
[super setFrame:frame];
[self _refreshIndicator:YES];
NSLog(@"%@, %@", NSStringFromCGRect(self.frame), NSStringFromCGRect(super.frame));
}
}
@ -191,6 +222,7 @@
- (void)setHideCurrentPageIndex:(BOOL)hideCurrentPageIndex {
if (_hideCurrentPageIndex != hideCurrentPageIndex) {
_hideCurrentPageIndex = hideCurrentPageIndex;
[self loadIndicatorIndexLabel];
}
}
@ -211,12 +243,14 @@
- (void)setCurrentPageIndexTintColor:(UIColor *)currentPageIndexTintColor {
if ( ![_currentPageIndexTextTintColor isEqual:currentPageIndexTintColor]) {
_currentPageIndexTextTintColor = currentPageIndexTintColor;
[self loadIndicatorIndexLabel];
}
}
- (void)setCurrentPageIndexTextFont:(UIFont *)currentPageIndexTextFont {
if ( ![_currentPageIndexTextFont isEqual:currentPageIndexTextFont]) {
_currentPageIndexTextFont = currentPageIndexTextFont;
[self loadIndicatorIndexLabel];
}
}
@ -228,9 +262,9 @@
} else {
[self setCurrentPage:self.currentPage + 1 forceRefresh:NO];
}
if (_currentPageChangedBlock) {
_currentPageChangedBlock(self);
if (_currentPageChanged) {
_currentPageChanged(self);
} else {
[self sendActionsForControlEvents:UIControlEventValueChanged];
}
@ -288,9 +322,9 @@
UIView *dot = [self _dotAtIndex:index];
[dot pop_removeAnimationForKey:RCDefaultIndicatorScaleAnimationKey];
POPPropertyAnimation *animation;
if (_disableAnimation) {
animation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewScaleXY];
((POPBasicAnimation *)animation).duration = RCDefaultIndicatorDotAnimationDurationMinValue;
@ -299,10 +333,10 @@
((POPSpringAnimation *)animation).springSpeed = _animationSpeed;
((POPSpringAnimation *)animation).springBounciness = _animationBounciness;
}
[animation setRemovedOnCompletion:YES];
animation.toValue = toValue;
[dot pop_addAnimation:animation forKey:RCDefaultIndicatorScaleAnimationKey];
}
@ -310,12 +344,12 @@
UIView *dot = [self _dotAtIndex:index];
[dot pop_removeAnimationForKey:RCDefaultIndicatorColorAnimationKey];
POPBasicAnimation *animation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewBackgroundColor];
[animation setRemovedOnCompletion:YES];
animation.toValue = toValue;
animation.duration = _disableAnimation ? RCDefaultIndicatorDotAnimationDurationMinValue : _animationDuration;
[dot pop_addAnimation:animation forKey:RCDefaultIndicatorColorAnimationKey];
}
@ -331,17 +365,25 @@
if (toPage >= 0 && fromPage >= 0) {
[self _dotScaleAnimationAtIndex:fromPage withProgress:1 - progress];
[self _dotScaleAnimationAtIndex:toPage withProgress:progress];
[self _dotColorAnimationAtIndex:fromPage withProgress:1 - progress];
[self _dotColorAnimationAtIndex:toPage withProgress:progress];
BOOL hidden = ![self _dotAtIndex:toPage] || ([self _scaledDotMaxWidth] < RCDefaultIndicatorDotIndexDisplayMinWidth) || (progress < 1 - RCDefaultIndicatorDotChangeProgressMinValue) || _hideCurrentPageIndex;
[_indicatorIndexLabel setHidden:hidden];
if ( !hidden) {
POPBasicAnimation *alphaAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewAlpha];
alphaAnimation.fromValue = @(0.f);
alphaAnimation.toValue = @(1.f);
alphaAnimation.duration = _disableAnimation ? 0 : _animationDuration;
[self bringSubviewToFront:_indicatorIndexLabel];
[_indicatorIndexLabel setCenter:[self _dotAtIndex:toPage].center];
[_indicatorIndexLabel setText:[NSString stringWithFormat:@"%d", toPage + 1]];
[_indicatorIndexLabel setAlpha:.3f];
[UIView animateWithDuration:_disableAnimation ? 0 : _animationDuration animations:^{
[_indicatorIndexLabel setAlpha:1.f];
}];
}
}
}
@ -357,46 +399,39 @@
- (void)_refreshIndicator:(BOOL)forceRefresh {
if ( !(_hidesForSinglePage && _numberOfPages <= 1)) {
[self setHidden:NO];
if (forceRefresh || self.subviews.count != _numberOfPages) {
CGPoint position = [self positionForNumberOfPages:self.numberOfPages];
NSInteger index = 0;
for (; index < _numberOfPages; index ++) {
CGRect frame = CGRectMake(position.x + index * (_indicatorDotGap + _indicatorDotWidth), position.y, _indicatorDotWidth, _indicatorDotWidth);
UIView *dot = [self _dotAtIndex:index] ?: [[UIView alloc] initWithFrame:frame];
if ([UIView respondsToSelector:@selector(performWithoutAnimation:)]) {
[UIView performWithoutAnimation:^{
[dot setTransform:CGAffineTransformIdentity];
}];
} else {
BOOL reenableAnimations = [UIView areAnimationsEnabled];
[UIView setAnimationsEnabled:NO];
[dot setTransform:CGAffineTransformIdentity];
[UIView setAnimationsEnabled:reenableAnimations];
}
[dot setTag:[self _dotTagAtIndex:index]];
[dot setBackgroundColor:_pageIndicatorTintColor];
[dot.layer setMasksToBounds:YES];
[dot.layer setCornerRadius:dot.frame.size.height / 2];
if ( !dot.superview) {
[self addSubview:dot];
} else {
[dot setFrame:frame];
}
}
for (; self.subviews.count && index < self.subviews.count - 1; index ++) {
[[self _dotAtIndex:index] removeFromSuperview];
}
[self _animateIndicator:forceRefresh];
}
if ( !_indicatorIndexLabel.superview) {
[self addSubview:_indicatorIndexLabel];
}
[self bringSubviewToFront:_indicatorIndexLabel];
} else {
[self setHidden:YES];
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

View File

@ -0,0 +1,5 @@
platform :ios, '6.0'
pod 'pop'
pod 'iCarousel'
pod 'RCPageControl', :path => '../'

View File

@ -0,0 +1,21 @@
PODS:
- iCarousel (1.8)
- pop (1.0.6)
- RCPageControl (0.1):
- pop
DEPENDENCIES:
- iCarousel
- pop
- RCPageControl (from `../`)
EXTERNAL SOURCES:
RCPageControl:
:path: ../
SPEC CHECKSUMS:
iCarousel: cf77aea48dfcde9a0cd85569a1d8a9b6dd543bd7
pop: e518794da38942c05255eb64b36d894e70cb4f00
RCPageControl: a2c06b0f3ca78ff600d7459c7ba8f996b36b0a20
COCOAPODS: 0.33.1

View File

@ -7,8 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
169BF7C6431C5E2677310144 /* libPods-RCPageControlExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3099E4A1A97225F48F6E6181 /* libPods-RCPageControlExample.a */; };
6E193FF01A0665C200F6FE20 /* avatar@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6E193FEF1A0665C200F6FE20 /* avatar@2x.png */; };
6E2F733B19C72600008985F7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2F733A19C72600008985F7 /* main.m */; };
6E2F733E19C72600008985F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2F733D19C72600008985F7 /* AppDelegate.m */; };
6E2F734119C72600008985F7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2F734019C72600008985F7 /* ViewController.m */; };
@ -16,7 +14,7 @@
6E2F734619C72601008985F7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6E2F734519C72601008985F7 /* Images.xcassets */; };
6E2F734919C72601008985F7 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6E2F734719C72601008985F7 /* LaunchScreen.xib */; };
6E2F735519C72601008985F7 /* RCPageControlExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2F735419C72601008985F7 /* RCPageControlExampleTests.m */; };
6E8AFCF61F3A34370010C4F4 /* RCPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E8AFCF51F3A34370010C4F4 /* RCPageControl.m */; };
D49C37915C534FBF81B1C62C /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E1326DC0F37B4CD9B3DC981C /* libPods.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -30,8 +28,6 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
3099E4A1A97225F48F6E6181 /* libPods-RCPageControlExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RCPageControlExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6E193FEF1A0665C200F6FE20 /* avatar@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "avatar@2x.png"; sourceTree = "<group>"; };
6E2F733519C72600008985F7 /* RCPageControlExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RCPageControlExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
6E2F733919C72600008985F7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6E2F733A19C72600008985F7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
@ -46,10 +42,8 @@
6E2F735319C72601008985F7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6E2F735419C72601008985F7 /* RCPageControlExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCPageControlExampleTests.m; sourceTree = "<group>"; };
6E55D24919C97C01008E8B03 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
6E8AFCF41F3A34370010C4F4 /* RCPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCPageControl.h; sourceTree = "<group>"; };
6E8AFCF51F3A34370010C4F4 /* RCPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCPageControl.m; sourceTree = "<group>"; };
D11654D66174B172FFDDF71E /* Pods-RCPageControlExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RCPageControlExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RCPageControlExample/Pods-RCPageControlExample.debug.xcconfig"; sourceTree = "<group>"; };
FD1395A5D82D7B32645E4135 /* Pods-RCPageControlExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RCPageControlExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-RCPageControlExample/Pods-RCPageControlExample.release.xcconfig"; sourceTree = "<group>"; };
8E717ED8CE5548A48B510212 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = "<group>"; };
E1326DC0F37B4CD9B3DC981C /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -57,7 +51,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
169BF7C6431C5E2677310144 /* libPods-RCPageControlExample.a in Frameworks */,
D49C37915C534FBF81B1C62C /* libPods.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -74,12 +68,11 @@
6E2F732C19C72600008985F7 = {
isa = PBXGroup;
children = (
6E8AFCF31F3A34370010C4F4 /* RCPageControl */,
6E2F733719C72600008985F7 /* RCPageControlExample */,
6E2F735119C72601008985F7 /* RCPageControlExampleTests */,
6E2F733619C72600008985F7 /* Products */,
8E717ED8CE5548A48B510212 /* Pods.xcconfig */,
7C549DD4BE2E4976BC588DB1 /* Frameworks */,
C7683FEE8934365031CE7145 /* Pods */,
);
sourceTree = "<group>";
};
@ -110,7 +103,6 @@
6E2F733819C72600008985F7 /* Supporting Files */ = {
isa = PBXGroup;
children = (
6E193FEF1A0665C200F6FE20 /* avatar@2x.png */,
6E2F733919C72600008985F7 /* Info.plist */,
6E2F733A19C72600008985F7 /* main.m */,
);
@ -134,33 +126,15 @@
name = "Supporting Files";
sourceTree = "<group>";
};
6E8AFCF31F3A34370010C4F4 /* RCPageControl */ = {
isa = PBXGroup;
children = (
6E8AFCF41F3A34370010C4F4 /* RCPageControl.h */,
6E8AFCF51F3A34370010C4F4 /* RCPageControl.m */,
);
path = RCPageControl;
sourceTree = "<group>";
};
7C549DD4BE2E4976BC588DB1 /* Frameworks */ = {
isa = PBXGroup;
children = (
6E55D24919C97C01008E8B03 /* MediaPlayer.framework */,
3099E4A1A97225F48F6E6181 /* libPods-RCPageControlExample.a */,
E1326DC0F37B4CD9B3DC981C /* libPods.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
C7683FEE8934365031CE7145 /* Pods */ = {
isa = PBXGroup;
children = (
D11654D66174B172FFDDF71E /* Pods-RCPageControlExample.debug.xcconfig */,
FD1395A5D82D7B32645E4135 /* Pods-RCPageControlExample.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -168,12 +142,11 @@
isa = PBXNativeTarget;
buildConfigurationList = 6E2F735819C72601008985F7 /* Build configuration list for PBXNativeTarget "RCPageControlExample" */;
buildPhases = (
9E048BD738EE8820190ADD16 /* [CP] Check Pods Manifest.lock */,
98157623954F4D229D890630 /* Check Pods Manifest.lock */,
6E2F733119C72600008985F7 /* Sources */,
6E2F733219C72600008985F7 /* Frameworks */,
6E2F733319C72600008985F7 /* Resources */,
A2370C85B17D17BCF0445069 /* [CP] Embed Pods Frameworks */,
6B00C6FD3B67BC3821DB0EF6 /* [CP] Copy Pods Resources */,
4205A7A3089C4258B519BEEC /* Copy Pods Resources */,
);
buildRules = (
);
@ -208,12 +181,11 @@
6E2F732D19C72600008985F7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0600;
ORGANIZATIONNAME = RidgeCorn;
TargetAttributes = {
6E2F733419C72600008985F7 = {
CreatedOnToolsVersion = 6.0;
DevelopmentTeam = 9MSN4G8M28;
};
6E2F734D19C72601008985F7 = {
CreatedOnToolsVersion = 6.0;
@ -221,7 +193,7 @@
};
};
};
buildConfigurationList = 6E2F733019C72600008985F7 /* Build configuration list for PBXProject "RCPageControl" */;
buildConfigurationList = 6E2F733019C72600008985F7 /* Build configuration list for PBXProject "RCPageControlExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@ -246,7 +218,6 @@
buildActionMask = 2147483647;
files = (
6E2F734419C72600008985F7 /* Main.storyboard in Resources */,
6E193FF01A0665C200F6FE20 /* avatar@2x.png in Resources */,
6E2F734919C72601008985F7 /* LaunchScreen.xib in Resources */,
6E2F734619C72601008985F7 /* Images.xcassets in Resources */,
);
@ -262,49 +233,34 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
6B00C6FD3B67BC3821DB0EF6 /* [CP] Copy Pods Resources */ = {
4205A7A3089C4258B519BEEC /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RCPageControlExample/Pods-RCPageControlExample-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9E048BD738EE8820190ADD16 /* [CP] Check Pods Manifest.lock */ = {
98157623954F4D229D890630 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Check Pods Manifest.lock";
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
A2370C85B17D17BCF0445069 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RCPageControlExample/Pods-RCPageControlExample-frameworks.sh\"\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@ -315,7 +271,6 @@
buildActionMask = 2147483647;
files = (
6E2F734119C72600008985F7 /* ViewController.m in Sources */,
6E8AFCF61F3A34370010C4F4 /* RCPageControl.m in Sources */,
6E2F733E19C72600008985F7 /* AppDelegate.m in Sources */,
6E2F733B19C72600008985F7 /* main.m in Sources */,
);
@ -372,19 +327,15 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@ -397,7 +348,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@ -417,10 +368,8 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@ -428,14 +377,13 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
@ -444,28 +392,22 @@
};
6E2F735919C72601008985F7 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = D11654D66174B172FFDDF71E /* Pods-RCPageControlExample.debug.xcconfig */;
baseConfigurationReference = 8E717ED8CE5548A48B510212 /* Pods.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9MSN4G8M28;
INFOPLIST_FILE = RCPageControlExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ridgecorn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
6E2F735A19C72601008985F7 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FD1395A5D82D7B32645E4135 /* Pods-RCPageControlExample.release.xcconfig */;
baseConfigurationReference = 8E717ED8CE5548A48B510212 /* Pods.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9MSN4G8M28;
INFOPLIST_FILE = RCPageControlExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ridgecorn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
@ -484,7 +426,6 @@
);
INFOPLIST_FILE = RCPageControlExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ridgecorn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RCPageControlExample.app/RCPageControlExample";
};
@ -500,7 +441,6 @@
);
INFOPLIST_FILE = RCPageControlExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ridgecorn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RCPageControlExample.app/RCPageControlExample";
};
@ -509,7 +449,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6E2F733019C72600008985F7 /* Build configuration list for PBXProject "RCPageControl" */ = {
6E2F733019C72600008985F7 /* Build configuration list for PBXProject "RCPageControlExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6E2F735619C72601008985F7 /* Debug */,

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:RCPageControlExample.xcodeproj">
</FileRef>
</Workspace>

View File

@ -3,7 +3,7 @@
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2017 Looping. All rights reserved.
// Copyright (c) 2014年 RidgeCorn. All rights reserved.
//
#import <UIKit/UIKit.h>

View File

@ -3,7 +3,7 @@
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2017 Looping. All rights reserved.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
//
#import "AppDelegate.h"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A388a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="14A343f" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@ -16,7 +16,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RCPageControlExample" textAlignment="center" lineBreakMode="middleTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RCPageControl Example" textAlignment="center" lineBreakMode="middleTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="49"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="Cyr-Tp-OgX"/>
@ -25,52 +25,19 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="avatar.png" translatesAutoresizingMaskIntoConstraints="NO" id="CcJ-FS-bTq">
<rect key="frame" x="210" y="60" width="60" height="60"/>
<constraints>
<constraint firstAttribute="height" constant="60" id="MjL-L0-v0Z"/>
<constraint firstAttribute="width" constant="60" id="TYT-NR-lB8"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Loading..." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tHr-Vp-7Bq">
<rect key="frame" x="0.0" y="249" width="480" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="B2e-gN-GVg"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="top" secondItem="CcJ-FS-bTq" secondAttribute="bottom" constant="60" id="4CJ-DR-Ijb"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="8ie-xW-0ye" secondAttribute="leading" id="IRR-lm-10m"/>
<constraint firstAttribute="centerX" secondItem="tHr-Vp-7Bq" secondAttribute="centerX" id="J0k-0K-uzS"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="trailing" secondItem="8ie-xW-0ye" secondAttribute="trailing" id="KGF-Xw-9yR"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="140" id="PTD-Of-H4F"/>
<constraint firstItem="tHr-Vp-7Bq" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Pfm-eQ-Grn"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="top" secondItem="CcJ-FS-bTq" secondAttribute="bottom" constant="60" id="TKV-hn-b7u"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstAttribute="trailing" secondItem="tHr-Vp-7Bq" secondAttribute="trailing" id="ZsU-1D-ExH"/>
<constraint firstItem="tHr-Vp-7Bq" firstAttribute="top" secondItem="kId-c2-rCX" secondAttribute="bottom" constant="60" id="diL-k6-Kb7"/>
<constraint firstAttribute="centerX" secondItem="CcJ-FS-bTq" secondAttribute="centerX" id="oNO-55-ONM"/>
<constraint firstItem="CcJ-FS-bTq" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="60" id="xts-df-xlS"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<variation key="default">
<mask key="constraints">
<exclude reference="4CJ-DR-Ijb"/>
<exclude reference="TKV-hn-b7u"/>
</mask>
</variation>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
<resources>
<image name="avatar.png" width="49" height="49"/>
</resources>
</document>

View File

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>com.ridgecorn.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -3,7 +3,7 @@
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2017 Looping. All rights reserved.
// Copyright (c) 2014年 RidgeCorn. All rights reserved.
//
#import <UIKit/UIKit.h>

View File

@ -3,11 +3,11 @@
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2017 Looping. All rights reserved.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
//
#import "ViewController.h"
#import "RCPageControl.h"
#import <RCPageControl.h>
#import <iCarousel.h>
@interface ViewController () <iCarouselDataSource, iCarouselDelegate>
@ -43,12 +43,12 @@
[_pageControlRC setCenter:({
CGPoint center = self.view.center;
center.y = self.view.frame.size.height - 160.f;
center.y = self.view.frame.size.height - 200.f;
center;
})];
__weak ViewController *weakSelf = self;
[_pageControlRC setCurrentPageChangedBlock:^(RCPageControl *pageControl) {
[_pageControlRC setCurrentPageChanged:^(RCPageControl *pageControl) {
[weakSelf.pageViews scrollToItemAtIndex:pageControl.currentPage animated:YES];
}];
}
@ -63,7 +63,7 @@
[_pageControlUI setCenter:({
CGPoint center = self.view.center;
center.y = 160.f;
center.y = 220.f;
center;
})];
@ -83,20 +83,7 @@
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view {
UIView *theNewView = view ?: ({
UIView *view = [[UIView alloc] initWithFrame:self.view.frame];
[view addSubview:({
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 60, 60)];
[imageView setCenter:view.center];
[imageView setImage:[UIImage imageNamed:@"avatar"]];
[imageView.layer setCornerRadius:imageView.frame.size.height / 2];
[imageView.layer setMasksToBounds:YES];
imageView;
})];
view;
});
UIView *theNewView = view ?: [[UIView alloc] initWithFrame:self.view.frame];
[theNewView setBackgroundColor:index % 3 ? index % 2 ? [[UIColor purpleColor] colorWithAlphaComponent:0.5] : [[UIColor blueColor] colorWithAlphaComponent:0.5] : [[UIColor cyanColor] colorWithAlphaComponent:0.5]];

View File

@ -3,7 +3,7 @@
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2017 Looping. All rights reserved.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
//
#import <UIKit/UIKit.h>

View File

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>com.ridgecorn.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -3,7 +3,7 @@
// RCPageControlExampleTests
//
// Created by Looping on 14/9/15.
// Copyright (c) 2017 Looping. All rights reserved.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
//
#import <UIKit/UIKit.h>
@ -30,13 +30,11 @@
XCTAssert(YES, @"Pass");
}
#ifdef __IPHONE_8_0
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
#endif
@end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

177
README.md
View File

@ -1,175 +1,4 @@
# RCPageControl
RCPageControl
=============
[![License MIT](https://go-shields.herokuapp.com/license-MIT-blue.png)](https://github.com/RidgeCorn/RCPageControl/blob/master/LICENSE)
[![Build Platform](https://cocoapod-badges.herokuapp.com/p/RCPageControl/badge.png)](https://github.com/RidgeCorn/RCPageControl)
[![Build Version](https://cocoapod-badges.herokuapp.com/v/RCPageControl/badge.png)](https://github.com/RidgeCorn/RCPageControl)
[![Build Status](https://travis-ci.org/RidgeCorn/RCPageControl.png?branch=master)](https://travis-ci.org/RidgeCorn/RCPageControl)
Yet another page control for iOS, with awesome animation powered by Facebook `pop` library.
<img src="https://github.com/RidgeCorn/RCPageControl/raw/master/RCPageControlDemo.gif" alt="RCPageControlDemo" width="320" height="568" />
**Any idea to make this more awesome? Please feel free to open an issue or make a PR.**
## Requirements
* Xcode 6.1 or higher
* iOS 6.0 or higher
* ARC
* [pop animation library](https://github.com/facebook/pop)
## Run Example
In your terminal,
``` bash
cd [workspace]/RCPageControl/RCPageControlExample
pod install
```
Then,
``` bash
open RCPageControlExample.xcworkspace
```
## Installation
The recommended approach for installating `RCPageControl` is via the [CocoaPods](http://cocoapods.org/) package manager.
In your `Podfile`, add a line shows below:
``` bash
pod 'RCPageControl'
```
Then,
``` bash
pod update
```
## Usage
The API of `RCPageControl` is highly similar
as `UIPageControl`.
### First of all
```objective-c
#import <RCPageControl.h>
```
### Initialization
- Using `initWithFrame:`
```objective-c
RCPageControl *pageControl = [RCPageControl initWithFrame:CGRectMake(0, 0, 100, 10)];
```
- Using `initWithNumberOfPages:`
```objective-c
RCPageControl *pageControl = [RCPageControl initWithNumberOfPages:5];
```
### Callback
- Using `UIControlEvent`
```objective-c
[pageControl addTarget:self action:@selector(changePage:) forControlEvents:UIControlEventValueChanged];
```
- Using `RCCurrentPageChangedBlock`
```objective-c
[pageControl setCurrentPageChangedBlock:^(RCPageControl *pageControl) {
//Code here
}];
```
### Properties
Just list new properties of `RCPageControl`.
- **indicatorDotGap**
The distance between two dots from their edges. Default value is `10.f`, cannot be smaller than `2.f`.
- **indicatorDotWidth**
The width of dot, you may assume that the dot is likes a circle. Default value is `4.f`, cannot be smaller than `2.f`.
- **animationSpeed** & **animationBounciness**
We use `POPSpringAnimation` for dots animation. See [POPSpringAnimation.h](https://github.com/facebook/pop/blob/master/pop/POPSpringAnimation.h) for more info.
- **animationDuration**
The duration for `UIView animation`. Using in `_indicatorIndexLabel` animation. Only available when `hideCurrentPageIndex` is setting to `NO`. Default is `0.6f`.
- **animationScaleFactor**
The dot scale factor. Using to calculate the width of current dot. Default is `2`.
- **hideCurrentPageIndex**
When set to `YES`, the `Page Index Label` will be hidden. Default is `NO`. The displayed page is start from `1`.
- **disableAnimation**
When set to `YES`, all indicator dots' changing animation will be disabled. Default is `NO`.
- **pageIndicatorTintColor**
The dot background color. Default is `[UIColor lightTextColor]`.
- **currentPageIndicatorTintColor**
The current dot background color. Default is `[UIColor whiteColor]`.
- **currentPageIndexTextTintColor**
The `Page Index Label`'s `TextColor`. Default is `[UIColor darkTextColor]`.
- **currentPageIndexTextFont**
The `Page Index Label`'s `Font`. Default is `[UIFont systemFontOfSize:0]`. The font size will automatically adjusts by the value of `indicatorDotWidth` and `animationScaleFactor`
## License
RCPageControl is available under the MIT license. See the [LICENSE](https://github.com/RidgeCorn/RCPageControl/blob/master/LICENSE) file for more info.
Yet another UI page control for iOS