Compare commits

...

27 Commits
0.1 ... master

Author SHA1 Message Date
Ivan Zinovyev 15bcbce38b
Merge pull request #1 from iznv/remove_text_from_dot
Remove text from dot
2018-11-27 12:28:57 +03:00
Ivan Zinovyev fcedb0b658 Remove text from dot 2018-11-07 16:57:12 +03:00
Looping e229c78166 Update License 2017 2017-08-09 02:23:36 +08:00
Looping 3d8ca30b0f Update copyright 2017 2017-08-09 02:20:13 +08:00
Looping 3c4de27ceb Update project structure 2017-08-09 02:12:30 +08:00
Looping 668133b3df Merge pull request #4 from olcayertas/patch-1
Fixed  #3
2017-08-08 12:51:01 -05:00
Olcay Ertaş 8eaa22e617 Fixed POP.h import
Original import statement was giving error:
#import <POP.h>
So I have changed it to:
#import <pop/POP.h>
2017-08-08 10:31:57 +03:00
Looping a811733e4a Fixed warnings 2017-06-09 02:29:33 +08:00
Looping 6b71952e45 Update project settings 2017-06-09 02:27:26 +08:00
Looping 9aeed43b8e Update Podfile format 2017-06-09 02:22:47 +08:00
Looping d2cf3306f6 v0.1.1 2015-03-10 22:53:43 +08:00
Looping 262ff55d3d Fixed issue #1 2015-03-09 17:42:26 +08:00
Looping 483e72cdfc Update dependencies for example project 2015-03-09 17:25:36 +08:00
Looping cc4af0a989 Update README format 2014-12-08 21:20:20 +08:00
Looping b77986598d Update README.md 2014-12-08 21:08:28 +08:00
Looping 2795887b44 Change animation fromValue to @(0.f) 2014-12-08 21:06:13 +08:00
Looping a42f05da0e Using POPBasicAnimation 2014-12-08 21:00:53 +08:00
Looping 0e975cef85 Update README.md 2014-11-02 23:50:52 +08:00
Looping cc360cc06f Change 'currentPageChanged' to 'currentPageChangedBlock' 2014-11-02 22:53:01 +08:00
Looping 3de11a9c80 Add .gif demo file 2014-11-02 22:19:41 +08:00
Looping 372ddb1ec0 Remove NSLog() output 2014-11-02 22:16:31 +08:00
Looping a52e32670f Fix a warning 2014-11-02 21:31:11 +08:00
Looping eb41a6f860 Add my avatar to make this project alive... :) 2014-11-02 21:29:05 +08:00
Looping ca7b4907de Fix TravisCI building error: no visible @interface for 'RCPageControlExampleTests' declares the selector 'measureBlock:' 2014-09-22 16:09:45 +08:00
Looping 8e701f6663 Add shared .xcscheme 2014-09-22 15:59:34 +08:00
Looping b8e24d825a Add .travis.yml 2014-09-22 15:46:23 +08:00
Looping 79e80b8082 Update Podfile.lock 2014-09-22 15:35:13 +08:00
25 changed files with 417 additions and 179 deletions

4
.travis.yml Normal file
View File

@ -0,0 +1,4 @@
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) 2014 RidgeCorn
Copyright (c) 2017 Looping
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

8
Podfile Normal file
View File

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

15
Podfile.lock Normal file
View File

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

View File

@ -7,6 +7,8 @@
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 */; };
@ -14,7 +16,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 */; };
D49C37915C534FBF81B1C62C /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E1326DC0F37B4CD9B3DC981C /* libPods.a */; };
6E8AFCF61F3A34370010C4F4 /* RCPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E8AFCF51F3A34370010C4F4 /* RCPageControl.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -28,6 +30,8 @@
/* 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>"; };
@ -42,8 +46,10 @@
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; };
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; };
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>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -51,7 +57,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D49C37915C534FBF81B1C62C /* libPods.a in Frameworks */,
169BF7C6431C5E2677310144 /* libPods-RCPageControlExample.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -68,11 +74,12 @@
6E2F732C19C72600008985F7 = {
isa = PBXGroup;
children = (
6E8AFCF31F3A34370010C4F4 /* RCPageControl */,
6E2F733719C72600008985F7 /* RCPageControlExample */,
6E2F735119C72601008985F7 /* RCPageControlExampleTests */,
6E2F733619C72600008985F7 /* Products */,
8E717ED8CE5548A48B510212 /* Pods.xcconfig */,
7C549DD4BE2E4976BC588DB1 /* Frameworks */,
C7683FEE8934365031CE7145 /* Pods */,
);
sourceTree = "<group>";
};
@ -103,6 +110,7 @@
6E2F733819C72600008985F7 /* Supporting Files */ = {
isa = PBXGroup;
children = (
6E193FEF1A0665C200F6FE20 /* avatar@2x.png */,
6E2F733919C72600008985F7 /* Info.plist */,
6E2F733A19C72600008985F7 /* main.m */,
);
@ -126,15 +134,33 @@
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 */,
E1326DC0F37B4CD9B3DC981C /* libPods.a */,
3099E4A1A97225F48F6E6181 /* libPods-RCPageControlExample.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 */
@ -142,11 +168,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 6E2F735819C72601008985F7 /* Build configuration list for PBXNativeTarget "RCPageControlExample" */;
buildPhases = (
98157623954F4D229D890630 /* Check Pods Manifest.lock */,
9E048BD738EE8820190ADD16 /* [CP] Check Pods Manifest.lock */,
6E2F733119C72600008985F7 /* Sources */,
6E2F733219C72600008985F7 /* Frameworks */,
6E2F733319C72600008985F7 /* Resources */,
4205A7A3089C4258B519BEEC /* Copy Pods Resources */,
A2370C85B17D17BCF0445069 /* [CP] Embed Pods Frameworks */,
6B00C6FD3B67BC3821DB0EF6 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@ -181,11 +208,12 @@
6E2F732D19C72600008985F7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
LastUpgradeCheck = 0830;
ORGANIZATIONNAME = RidgeCorn;
TargetAttributes = {
6E2F733419C72600008985F7 = {
CreatedOnToolsVersion = 6.0;
DevelopmentTeam = 9MSN4G8M28;
};
6E2F734D19C72601008985F7 = {
CreatedOnToolsVersion = 6.0;
@ -193,7 +221,7 @@
};
};
};
buildConfigurationList = 6E2F733019C72600008985F7 /* Build configuration list for PBXProject "RCPageControlExample" */;
buildConfigurationList = 6E2F733019C72600008985F7 /* Build configuration list for PBXProject "RCPageControl" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@ -218,6 +246,7 @@
buildActionMask = 2147483647;
files = (
6E2F734419C72600008985F7 /* Main.storyboard in Resources */,
6E193FF01A0665C200F6FE20 /* avatar@2x.png in Resources */,
6E2F734919C72601008985F7 /* LaunchScreen.xib in Resources */,
6E2F734619C72601008985F7 /* Images.xcassets in Resources */,
);
@ -233,34 +262,49 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
4205A7A3089C4258B519BEEC /* Copy Pods Resources */ = {
6B00C6FD3B67BC3821DB0EF6 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RCPageControlExample/Pods-RCPageControlExample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
98157623954F4D229D890630 /* Check Pods Manifest.lock */ = {
9E048BD738EE8820190ADD16 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
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";
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";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@ -271,6 +315,7 @@
buildActionMask = 2147483647;
files = (
6E2F734119C72600008985F7 /* ViewController.m in Sources */,
6E8AFCF61F3A34370010C4F4 /* RCPageControl.m in Sources */,
6E2F733E19C72600008985F7 /* AppDelegate.m in Sources */,
6E2F733B19C72600008985F7 /* main.m in Sources */,
);
@ -327,15 +372,19 @@
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",
@ -348,7 +397,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@ -368,8 +417,10 @@
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";
@ -377,13 +428,14 @@
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 = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
@ -392,22 +444,28 @@
};
6E2F735919C72601008985F7 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8E717ED8CE5548A48B510212 /* Pods.xcconfig */;
baseConfigurationReference = D11654D66174B172FFDDF71E /* Pods-RCPageControlExample.debug.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 = 8E717ED8CE5548A48B510212 /* Pods.xcconfig */;
baseConfigurationReference = FD1395A5D82D7B32645E4135 /* Pods-RCPageControlExample.release.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;
@ -426,6 +484,7 @@
);
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";
};
@ -441,6 +500,7 @@
);
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";
};
@ -449,7 +509,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6E2F733019C72600008985F7 /* Build configuration list for PBXProject "RCPageControlExample" */ = {
6E2F733019C72600008985F7 /* Build configuration list for PBXProject "RCPageControl" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6E2F735619C72601008985F7 /* Debug */,

View File

@ -1,15 +1,15 @@
//
// RCPageControl.h
// RCPageControlExample
// RCPageControl
//
// Created by Looping on 14/9/15.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
// Copyright (c) 2017 Looping. All rights reserved.
//
/**
The MIT License (MIT)
Copyright (c) 2014 RidgeCorn
Copyright (c) 2017 Looping
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 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

View File

@ -1,26 +1,26 @@
//
// RCPageControl.m
// RCPageControlExample
// RCPageControl
//
// Created by Looping on 14/9/15.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
// Copyright (c) 2017 Looping. All rights reserved.
//
/**
The MIT License (MIT)
Copyright (c) 2014 RidgeCorn
Copyright (c) 2017 Looping
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.h>
#import <pop/POP.h>
#define RCDefaultIndicatorDotBaseTag 1009
@ -48,15 +48,15 @@
#define RCDefaultIndicatorScaleAnimationKey @"RCPageControlIndicatorScaleAnimation"
#define RCDefaultIndicatorColorAnimationKey @"RCPageControlIndicatorColorAnimation"
#define RCDefaultIndicatorIndexLabelAlphaAnimationKey @"RCDefaultIndicatorIndexLabelAlphaAnimationKey"
#define IsFloatZero(A) fabsf(A) < FLT_EPSILON
#define IsFloatZero(A) (fabs(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,97 +72,70 @@
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];
@ -175,21 +148,20 @@
- (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];
}
}
@ -197,8 +169,7 @@
- (void)setAnimationScaleFactor:(NSInteger)animationScaleFactor {
if ( _animationScaleFactor != animationScaleFactor) {
_animationScaleFactor = MAX(RCDefaultIndicatorDotScaleFactorMinValue, animationScaleFactor);
[self loadIndicatorIndexLabel];
[self _dotScaleAnimationAtIndex:_currentDisplayedPage withProgress:RCDefaultIndicatorDotChangeProgressMaxValue];
}
}
@ -207,8 +178,6 @@
if ( !CGRectEqualToRect(self.frame, frame)) {
[super setFrame:frame];
[self _refreshIndicator:YES];
NSLog(@"%@, %@", NSStringFromCGRect(self.frame), NSStringFromCGRect(super.frame));
}
}
@ -222,7 +191,6 @@
- (void)setHideCurrentPageIndex:(BOOL)hideCurrentPageIndex {
if (_hideCurrentPageIndex != hideCurrentPageIndex) {
_hideCurrentPageIndex = hideCurrentPageIndex;
[self loadIndicatorIndexLabel];
}
}
@ -243,14 +211,12 @@
- (void)setCurrentPageIndexTintColor:(UIColor *)currentPageIndexTintColor {
if ( ![_currentPageIndexTextTintColor isEqual:currentPageIndexTintColor]) {
_currentPageIndexTextTintColor = currentPageIndexTintColor;
[self loadIndicatorIndexLabel];
}
}
- (void)setCurrentPageIndexTextFont:(UIFont *)currentPageIndexTextFont {
if ( ![_currentPageIndexTextFont isEqual:currentPageIndexTextFont]) {
_currentPageIndexTextFont = currentPageIndexTextFont;
[self loadIndicatorIndexLabel];
}
}
@ -262,9 +228,9 @@
} else {
[self setCurrentPage:self.currentPage + 1 forceRefresh:NO];
}
if (_currentPageChanged) {
_currentPageChanged(self);
if (_currentPageChangedBlock) {
_currentPageChangedBlock(self);
} else {
[self sendActionsForControlEvents:UIControlEventValueChanged];
}
@ -322,9 +288,9 @@
UIView *dot = [self _dotAtIndex:index];
[dot pop_removeAnimationForKey:RCDefaultIndicatorScaleAnimationKey];
POPPropertyAnimation *animation;
if (_disableAnimation) {
animation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewScaleXY];
((POPBasicAnimation *)animation).duration = RCDefaultIndicatorDotAnimationDurationMinValue;
@ -333,10 +299,10 @@
((POPSpringAnimation *)animation).springSpeed = _animationSpeed;
((POPSpringAnimation *)animation).springBounciness = _animationBounciness;
}
[animation setRemovedOnCompletion:YES];
animation.toValue = toValue;
[dot pop_addAnimation:animation forKey:RCDefaultIndicatorScaleAnimationKey];
}
@ -344,12 +310,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];
}
@ -365,25 +331,17 @@
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) {
[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];
}];
POPBasicAnimation *alphaAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewAlpha];
alphaAnimation.fromValue = @(0.f);
alphaAnimation.toValue = @(1.f);
alphaAnimation.duration = _disableAnimation ? 0 : _animationDuration;
}
}
}
@ -399,39 +357,46 @@
- (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];
}

BIN
RCPageControlDemo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

View File

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

View File

@ -3,7 +3,7 @@
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
// Copyright (c) 2017 Looping. 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="6245" systemVersion="14A343f" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<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">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
</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="RCPageControl Example" 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="RCPageControlExample" 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,19 +25,52 @@
<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>com.ridgecorn.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

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

View File

@ -1,21 +0,0 @@
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

@ -1,7 +0,0 @@
<?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) 2014年 RidgeCorn. All rights reserved.
// Copyright (c) 2017 Looping. All rights reserved.
//
#import <UIKit/UIKit.h>

View File

@ -3,11 +3,11 @@
// RCPageControlExample
//
// Created by Looping on 14/9/15.
// Copyright (c) 2014 RidgeCorn. All rights reserved.
// Copyright (c) 2017 Looping. 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 - 200.f;
center.y = self.view.frame.size.height - 160.f;
center;
})];
__weak ViewController *weakSelf = self;
[_pageControlRC setCurrentPageChanged:^(RCPageControl *pageControl) {
[_pageControlRC setCurrentPageChangedBlock:^(RCPageControl *pageControl) {
[weakSelf.pageViews scrollToItemAtIndex:pageControl.currentPage animated:YES];
}];
}
@ -63,7 +63,7 @@
[_pageControlUI setCenter:({
CGPoint center = self.view.center;
center.y = 220.f;
center.y = 160.f;
center;
})];
@ -83,7 +83,20 @@
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view {
UIView *theNewView = view ?: [[UIView alloc] initWithFrame:self.view.frame];
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;
});
[theNewView setBackgroundColor:index % 3 ? index % 2 ? [[UIColor purpleColor] colorWithAlphaComponent:0.5] : [[UIColor blueColor] colorWithAlphaComponent:0.5] : [[UIColor cyanColor] colorWithAlphaComponent:0.5]];

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

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

View File

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.ridgecorn.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</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) 2014 RidgeCorn. All rights reserved.
// Copyright (c) 2017 Looping. All rights reserved.
//
#import <UIKit/UIKit.h>
@ -30,11 +30,13 @@
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

177
README.md
View File

@ -1,4 +1,175 @@
RCPageControl
=============
# RCPageControl
Yet another UI page control for iOS
[![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.