├── 1.gif
├── 2.gif
├── GWLCustomSlider
├── Images.xcassets
│ ├── red.imageset
│ │ ├── red@2x.png
│ │ └── Contents.json
│ ├── blue.imageset
│ │ ├── blue@2x.png
│ │ └── Contents.json
│ ├── icon_jiage.imageset
│ │ ├── icon_jiage@2x.png
│ │ └── Contents.json
│ ├── LaunchImage.launchimage
│ │ ├── Default@2x.png
│ │ ├── Default-568h@2x.png
│ │ └── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── DemoViewController.h
├── ViewController.h
├── DemoNewViewController.h
├── AppDelegate.h
├── main.m
├── PrefixHeader.pch
├── UIView+Add.h
├── AppDelegate.m
├── GWLCustomSliderNew.h
├── GWLCustomSlider.h
├── Info.plist
├── UIView+Add.m
├── DemoNewViewController.m
├── DemoViewController.m
├── ViewController.m
├── GWLCustomSlider.m
└── GWLCustomSliderNew.m
├── GWLCustomSlider.xcodeproj
├── xcuserdata
│ ├── test.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── GWLCustomSlider.xcscheme
│ └── gaowanli.xcuserdatad
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── GWLCustomSlider.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ ├── test.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ │ └── gaowanli.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── GWLCustomSlider.xccheckout
└── project.pbxproj
├── README.md
└── GWLCustomSliderTests
├── Info.plist
└── GWLCustomSliderTests.m
/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/1.gif
--------------------------------------------------------------------------------
/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/2.gif
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/red.imageset/red@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/GWLCustomSlider/Images.xcassets/red.imageset/red@2x.png
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/blue.imageset/blue@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/GWLCustomSlider/Images.xcassets/blue.imageset/blue@2x.png
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/icon_jiage.imageset/icon_jiage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/GWLCustomSlider/Images.xcassets/icon_jiage.imageset/icon_jiage@2x.png
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/xcuserdata/test.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/GWLCustomSlider/Images.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/GWLCustomSlider/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GWLCustomSlider
2 | 自定义slider,用于选择一个区间值
3 |
4 | 
5 | 
6 |
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/project.xcworkspace/xcuserdata/test.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/GWLCustomSlider.xcodeproj/project.xcworkspace/xcuserdata/test.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/project.xcworkspace/xcuserdata/gaowanli.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaowanli/GWLCustomSlider/HEAD/GWLCustomSlider.xcodeproj/project.xcworkspace/xcuserdata/gaowanli.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/GWLCustomSlider/DemoViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // DemoViewController.h
3 | // GWLCustomSlider
4 | //
5 | // Created by 高万里 on 15/6/7.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface DemoViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/GWLCustomSlider/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // GWLCustomSlider
4 | //
5 | // Created by 高万里 on 15/6/7.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/GWLCustomSlider/DemoNewViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // DemoNewViewController.h
3 | // GWLCustomSlider
4 | //
5 | // Created by Gaowl on 15/6/11.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface DemoNewViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/GWLCustomSlider/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // GWLCustomSlider
4 | //
5 | // Created by 高万里 on 15/6/7.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/GWLCustomSlider/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // GWLCustomSlider
4 | //
5 | // Created by 高万里 on 15/6/7.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GWLCustomSlider/PrefixHeader.pch:
--------------------------------------------------------------------------------
1 |
2 | //
3 | // PrefixHeader.pch
4 | // CustomSlider
5 | //
6 | // Created by 高万里 on 15/6/6.
7 | // Copyright (c) 2015年 高万里. All rights reserved.
8 | //
9 |
10 | #ifndef CustomSlider_PrefixHeader_pch
11 | #define CustomSlider_PrefixHeader_pch
12 |
13 | #define kSCREENW ([UIScreen mainScreen].bounds.size.width)
14 | #define kSCREENH ([UIScreen mainScreen].bounds.size.height)
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/red.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "red@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/blue.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "blue@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/icon_jiage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "icon_jiage@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/project.xcworkspace/xcuserdata/test.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/GWLCustomSlider/UIView+Add.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Add.h
3 | // Copyright (c) 2014年 高万里. All rights reserved.
4 | //
5 |
6 | #import
7 |
8 | @interface UIView (Add)
9 |
10 | @property(nonatomic,assign) CGFloat centerX;
11 | @property(nonatomic,assign) CGFloat centerY;
12 | @property(nonatomic,assign) CGFloat X;
13 | @property(nonatomic,assign) CGFloat Y;
14 | @property(nonatomic,assign) CGFloat width;
15 | @property(nonatomic,assign) CGFloat height;
16 | @property(nonatomic,assign) CGSize size;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "filename" : "Default@2x.png",
8 | "minimum-system-version" : "7.0",
9 | "scale" : "2x"
10 | },
11 | {
12 | "extent" : "full-screen",
13 | "idiom" : "iphone",
14 | "subtype" : "retina4",
15 | "filename" : "Default-568h@2x.png",
16 | "minimum-system-version" : "7.0",
17 | "orientation" : "portrait",
18 | "scale" : "2x"
19 | }
20 | ],
21 | "info" : {
22 | "version" : 1,
23 | "author" : "xcode"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/xcuserdata/test.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | GWLCustomSlider.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | AD5788311B2420250059FDF7
16 |
17 | primary
18 |
19 |
20 | AD57884A1B2420260059FDF7
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/xcuserdata/gaowanli.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | GWLCustomSlider.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | AD5788311B2420250059FDF7
16 |
17 | primary
18 |
19 |
20 | AD57884A1B2420260059FDF7
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/GWLCustomSlider/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // GWLCustomSlider
4 | //
5 | // Created by 高万里 on 15/6/7.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "ViewController.h"
11 |
12 | @interface AppDelegate ()
13 |
14 | @end
15 |
16 | @implementation AppDelegate
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
20 | ViewController *vc = [[ViewController alloc]init];
21 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
22 | self.window.rootViewController = nav;
23 | [self.window makeKeyAndVisible];
24 | return YES;
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/GWLCustomSliderTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | cn.gaowanli.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/GWLCustomSliderTests/GWLCustomSliderTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // GWLCustomSliderTests.m
3 | // GWLCustomSliderTests
4 | //
5 | // Created by 高万里 on 15/6/7.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface GWLCustomSliderTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation GWLCustomSliderTests
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/GWLCustomSlider/GWLCustomSliderNew.h:
--------------------------------------------------------------------------------
1 | //
2 | // GWLCustomSliderNew.h
3 | // GWLCustomSliderNew
4 | //
5 | // Created by 高万里 on 15/6/11.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class GWLCustomSliderNew;
12 | @protocol GWLCustomSliderNewDelegate
13 |
14 | /**
15 | * slider值改变的代理方法
16 | *
17 | * @param slider slider
18 | * @param minValue 最小值
19 | * @param maxValue 最大值
20 | */
21 | - (void)customSliderValueChanged:(GWLCustomSliderNew *)slider minValue:(NSString *)minValue maxValue:(NSString *)maxValue;
22 |
23 | @end
24 |
25 | @interface GWLCustomSliderNew : UIView
26 |
27 | /**
28 | * 初始化一个slider
29 | *
30 | * @param defalutMinValue 初始化显示的最小值
31 | * @param defalutMaxValue 初始化显示的最大值
32 | * @param minMaxCanSame 最小值和最大值是否可以一样
33 | */
34 | + (instancetype)customSliderWithDefalutMinValue:(float)defalutMinValue withDefalutMaxValue:(float)defalutMaxValue andMinMaxCanSame:(BOOL)minMaxCanSame;
35 |
36 | @property(nonatomic,weak)id delegate;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/GWLCustomSlider/GWLCustomSlider.h:
--------------------------------------------------------------------------------
1 | //
2 | // GWLCustomSlider.h
3 | // GWLCustomSlider
4 | //
5 | // Created by 高万里 on 15/6/6.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class GWLCustomSlider;
12 | @protocol GWLCustomSliderDelegate
13 |
14 | /**
15 | * slider值改变的代理方法
16 | *
17 | * @param slider slider
18 | * @param minValue 最小值
19 | * @param maxValue 最大值
20 | */
21 | - (void)customSliderValueChanged:(GWLCustomSlider *)slider minValue:(NSString *)minValue maxValue:(NSString *)maxValue;
22 |
23 | @end
24 |
25 | @interface GWLCustomSlider : UIView
26 |
27 | /**
28 | * 初始化一个slider
29 | *
30 | * @param titleArray 标题数组
31 | * @param defalutMinValueIndex 初始化显示的最小值index
32 | * @param defalutMaxValueIndex 初始化显示的最大值index
33 | * @param minMaxCanSame 最小值和最大值是否可以一样
34 | */
35 | + (instancetype)customSliderWithTitleArray:(NSArray *)titleArray withDefalutMinValueIndex:(NSInteger)defalutMinValueIndex withDefalutMaxValueIndex:(NSInteger)defalutMaxValueIndex andMinMaxCanSame:(BOOL)minMaxCanSame;
36 |
37 | @property(nonatomic,weak)id delegate;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/GWLCustomSlider/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | cn.gaowanli.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/project.xcworkspace/xcshareddata/GWLCustomSlider.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 3ED3C519-AE4A-4E81-A655-2CE041C7219C
9 | IDESourceControlProjectName
10 | GWLCustomSlider
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 12FF05ABA4EC5B837E026A6D0320F28A7DB7C39D
14 | https://github.com/gaowanli/GWLCustomSlider.git
15 |
16 | IDESourceControlProjectPath
17 | GWLCustomSlider.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 12FF05ABA4EC5B837E026A6D0320F28A7DB7C39D
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/gaowanli/GWLCustomSlider.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 12FF05ABA4EC5B837E026A6D0320F28A7DB7C39D
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 12FF05ABA4EC5B837E026A6D0320F28A7DB7C39D
36 | IDESourceControlWCCName
37 | GWLCustomSlider
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/GWLCustomSlider/UIView+Add.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Add.m
3 | // Copyright (c) 2014年 高万里. All rights reserved.
4 | //
5 |
6 | #import "UIView+Add.h"
7 |
8 | @implementation UIView (Add)
9 |
10 | - (void)setCenterX:(CGFloat)centerX
11 | {
12 | CGPoint center = self.center;
13 | center.x = centerX;
14 | self.center = center;
15 | }
16 |
17 | - (CGFloat)centerX
18 | {
19 | return self.center.x;
20 | }
21 |
22 | - (void)setCenterY:(CGFloat)centerY
23 | {
24 | CGPoint center = self.center;
25 | center.y = centerY;
26 | self.center = center;
27 | }
28 |
29 | - (CGFloat)centerY
30 | {
31 | return self.center.y;
32 | }
33 |
34 | - (void)setY:(CGFloat)Y
35 | {
36 | CGRect frameT = self.frame;
37 | frameT.origin.y = Y;
38 | self.frame = frameT;
39 | }
40 |
41 | - (CGFloat)Y
42 | {
43 | return self.frame.origin.y;
44 | }
45 |
46 | - (void)setX:(CGFloat)X
47 | {
48 | CGRect frameT = self.frame;
49 | frameT.origin.x = X;
50 | self.frame = frameT;
51 | }
52 |
53 | - (CGFloat)X
54 | {
55 | return self.frame.origin.x;
56 | }
57 |
58 | -(void)setWidth:(CGFloat)width
59 | {
60 | CGRect frameT = self.frame;
61 | frameT.size.width = width;
62 | self.frame = frameT;
63 | }
64 |
65 | - (CGFloat)width
66 | {
67 | return self.frame.size.width;
68 | }
69 |
70 | - (void)setHeight:(CGFloat)height
71 | {
72 | CGRect frameT = self.frame;
73 | frameT.size.height = height;
74 | self.frame = frameT;
75 | }
76 |
77 | - (CGFloat)height
78 | {
79 | return self.frame.size.height;
80 | }
81 |
82 | - (void)setSize:(CGSize)size
83 | {
84 | CGRect frameT = self.frame;
85 | frameT.size = size;
86 | self.frame = frameT;
87 | }
88 |
89 | - (CGSize)size
90 | {
91 | return self.frame.size;
92 | }
93 |
94 | @end
95 |
--------------------------------------------------------------------------------
/GWLCustomSlider/DemoNewViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // DemoNewViewController.m
3 | // GWLCustomSlider
4 | //
5 | // Created by Gaowl on 15/6/11.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import "DemoNewViewController.h"
10 | #import "UIView+Add.h"
11 | #import "GWLCustomSliderNew.h"
12 |
13 | @interface DemoNewViewController ()
14 |
15 | @property(nonatomic, weak) GWLCustomSliderNew *customSlider;
16 | @property(nonatomic,weak)UILabel *sliderValueLabel;
17 |
18 | @end
19 |
20 | @implementation DemoNewViewController
21 |
22 | - (void)viewDidLoad {
23 | [super viewDidLoad];
24 | self.view.backgroundColor = [UIColor whiteColor];
25 | self.title = @"第二版 CustomSlider";
26 |
27 | GWLCustomSliderNew *customSlider = [GWLCustomSliderNew customSliderWithDefalutMinValue:12 withDefalutMaxValue:75 andMinMaxCanSame:YES];
28 | customSlider.frame = CGRectMake(10, 100, kSCREENW-20, 100);
29 | customSlider.delegate = self;
30 | [self.view addSubview:customSlider];
31 | self.customSlider = customSlider;
32 | }
33 |
34 | #pragma mark - GWLCustomSliderNewDelegate
35 | - (void)customSliderValueChanged:(GWLCustomSliderNew *)slider minValue:(NSString *)minValue maxValue:(NSString *)maxValue
36 | {
37 | self.sliderValueLabel.text = [NSString stringWithFormat:@"范围:%@ - %@",minValue,maxValue];
38 | }
39 |
40 | - (UILabel *)sliderValueLabel {
41 | if (!_sliderValueLabel) {
42 | UILabel *sliderValueLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(self.customSlider.frame)+10, kSCREENW-20, 44)];
43 | sliderValueLabel.textColor = [UIColor whiteColor];
44 | sliderValueLabel.backgroundColor = [UIColor lightGrayColor];
45 | sliderValueLabel.font = [UIFont systemFontOfSize:15.0];
46 | sliderValueLabel.textAlignment = NSTextAlignmentCenter;
47 | [self.view addSubview:sliderValueLabel];
48 | _sliderValueLabel = sliderValueLabel;
49 | }
50 | return _sliderValueLabel;
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/GWLCustomSlider/DemoViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // DemoViewController.m
3 | // GWLCustomSlider
4 | //
5 | // Created by 高万里 on 15/6/6.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import "DemoViewController.h"
10 | #import "GWLCustomSlider.h"
11 | #import "DemoNewViewController.h"
12 |
13 | @interface DemoViewController ()
14 |
15 | @property(nonatomic,weak)GWLCustomSlider *customSlider;
16 | @property(nonatomic,weak)UILabel *sliderValueLabel;
17 |
18 | @end
19 |
20 | @implementation DemoViewController
21 |
22 | - (void)viewDidLoad {
23 | [super viewDidLoad];
24 | self.view.backgroundColor = [UIColor whiteColor];
25 | self.title = @"第一版 CustomSlider";
26 |
27 | UIBarButtonItem *nextBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(nextBarButtonItemDidClick)];
28 | self.navigationItem.rightBarButtonItem = nextBarButtonItem;
29 |
30 | NSArray *titleArray = @[@"10",@"20",@"30",@"40",@"50",@"60",@"70",@"80",@"90",@"100",@"更多"];
31 | GWLCustomSlider *customSlider = [GWLCustomSlider customSliderWithTitleArray:titleArray withDefalutMinValueIndex:0 withDefalutMaxValueIndex:5 andMinMaxCanSame:YES];
32 | customSlider.frame = CGRectMake(10, 100, kSCREENW-20, 0);
33 | customSlider.delegate = self;
34 | [self.view addSubview:customSlider];
35 | self.customSlider = customSlider;
36 | }
37 |
38 | - (void)nextBarButtonItemDidClick {
39 | DemoNewViewController *customSliderNewViewController = [[DemoNewViewController alloc]init];
40 | [self.navigationController pushViewController:customSliderNewViewController animated:YES];
41 | }
42 |
43 | #pragma mark - CustomSliderDelegate
44 | - (void)customSliderValueChanged:(GWLCustomSlider *)slider minValue:(NSString *)minValue maxValue:(NSString *)maxValue {
45 | self.sliderValueLabel.text = [NSString stringWithFormat:@"范围:%@ - %@",minValue,maxValue];
46 | }
47 |
48 | - (UILabel *)sliderValueLabel {
49 | if (!_sliderValueLabel) {
50 | UILabel *sliderValueLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(self.customSlider.frame)+10, kSCREENW-20, 44)];
51 | sliderValueLabel.textColor = [UIColor whiteColor];
52 | sliderValueLabel.backgroundColor = [UIColor lightGrayColor];
53 | sliderValueLabel.font = [UIFont systemFontOfSize:15.0];
54 | sliderValueLabel.textAlignment = NSTextAlignmentCenter;
55 | [self.view addSubview:sliderValueLabel];
56 | _sliderValueLabel = sliderValueLabel;
57 | }
58 | return _sliderValueLabel;
59 | }
60 |
61 | @end
--------------------------------------------------------------------------------
/GWLCustomSlider/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "3x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "3x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "57x57",
31 | "scale" : "1x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "57x57",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "iphone",
45 | "size" : "60x60",
46 | "scale" : "3x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "29x29",
51 | "scale" : "1x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "2x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "40x40",
61 | "scale" : "1x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "2x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "50x50",
71 | "scale" : "1x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "50x50",
76 | "scale" : "2x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "72x72",
81 | "scale" : "1x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "72x72",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ipad",
90 | "size" : "76x76",
91 | "scale" : "1x"
92 | },
93 | {
94 | "idiom" : "ipad",
95 | "size" : "76x76",
96 | "scale" : "2x"
97 | },
98 | {
99 | "idiom" : "car",
100 | "size" : "120x120",
101 | "scale" : "1x"
102 | },
103 | {
104 | "size" : "24x24",
105 | "idiom" : "watch",
106 | "scale" : "2x",
107 | "role" : "notificationCenter",
108 | "subtype" : "38mm"
109 | },
110 | {
111 | "size" : "27.5x27.5",
112 | "idiom" : "watch",
113 | "scale" : "2x",
114 | "role" : "notificationCenter",
115 | "subtype" : "42mm"
116 | },
117 | {
118 | "size" : "29x29",
119 | "idiom" : "watch",
120 | "role" : "companionSettings",
121 | "scale" : "2x"
122 | },
123 | {
124 | "size" : "29x29",
125 | "idiom" : "watch",
126 | "role" : "companionSettings",
127 | "scale" : "3x"
128 | },
129 | {
130 | "size" : "40x40",
131 | "idiom" : "watch",
132 | "scale" : "2x",
133 | "role" : "appLauncher",
134 | "subtype" : "38mm"
135 | },
136 | {
137 | "size" : "44x44",
138 | "idiom" : "watch",
139 | "scale" : "2x",
140 | "role" : "longLook",
141 | "subtype" : "42mm"
142 | },
143 | {
144 | "size" : "86x86",
145 | "idiom" : "watch",
146 | "scale" : "2x",
147 | "role" : "quickLook",
148 | "subtype" : "38mm"
149 | },
150 | {
151 | "size" : "98x98",
152 | "idiom" : "watch",
153 | "scale" : "2x",
154 | "role" : "quickLook",
155 | "subtype" : "42mm"
156 | }
157 | ],
158 | "info" : {
159 | "version" : 1,
160 | "author" : "xcode"
161 | }
162 | }
--------------------------------------------------------------------------------
/GWLCustomSlider/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // CustomSlider
4 | //
5 | // Created by 高万里 on 15/6/6.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "DemoViewController.h"
11 |
12 | @interface ViewController ()
13 |
14 | @property(nonatomic,weak)UISlider *intValueSlider;
15 | @property(nonatomic,weak)UILabel *intValueLabel;
16 |
17 | @property(nonatomic,weak)UISlider *floatValueSlider;
18 | @property(nonatomic,weak)UILabel *floatValueLabel;
19 |
20 | @end
21 |
22 | @implementation ViewController
23 |
24 | - (void)viewDidLoad {
25 | [super viewDidLoad];
26 | self.view.backgroundColor = [UIColor whiteColor];
27 | self.title = @"系统 UISlider";
28 |
29 | UISlider *intValueSlider = [[UISlider alloc]initWithFrame:CGRectMake(10, 100, kSCREENW-20, 44)];
30 | intValueSlider.maximumValue = 100;
31 | intValueSlider.minimumValue = 10;
32 | [intValueSlider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
33 | [self.view addSubview:intValueSlider];
34 | self.intValueSlider = intValueSlider;
35 | self.intValueLabel.text = @"0";
36 |
37 | UISlider *floatValueSlider = [[UISlider alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(self.intValueLabel.frame)+10, kSCREENW-20, 44)];
38 | floatValueSlider.maximumValue = 100;
39 | floatValueSlider.minimumValue = 10;
40 | [floatValueSlider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
41 | [self.view addSubview:floatValueSlider];
42 | self.floatValueSlider = floatValueSlider;
43 | self.floatValueLabel.text = @"0.00";
44 |
45 | UIBarButtonItem *nextBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(nextBarButtonItemDidClick)];
46 | self.navigationItem.rightBarButtonItem = nextBarButtonItem;
47 | }
48 |
49 | - (void)sliderValueChanged:(UISlider *)slider {
50 | float floatValue = slider.value;
51 | if (slider == self.floatValueSlider) {
52 | self.floatValueLabel.text = [NSString stringWithFormat:@"%.2lf",slider.value];
53 | return;
54 | }
55 |
56 | int intValue = (int)ceilf(floatValue);
57 | int setValue = 0;
58 | if (intValue%10 < 5) {
59 | setValue = intValue/10*10;
60 | }else{
61 | setValue = (intValue/10+1) *10;
62 | }
63 | [slider setValue:(float)setValue];
64 | self.intValueLabel.text = [NSString stringWithFormat:@"%d",(int)slider.value];
65 | }
66 |
67 | - (void)nextBarButtonItemDidClick {
68 | DemoViewController *customSliderViewController = [[DemoViewController alloc]init];
69 | [self.navigationController pushViewController:customSliderViewController animated:YES];
70 | }
71 |
72 | - (UILabel *)intValueLabel {
73 | if (!_intValueLabel) {
74 | UILabel *intValueLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(self.intValueSlider.frame)+10, kSCREENW-20, 44)];
75 | intValueLabel.textColor = [UIColor whiteColor];
76 | intValueLabel.backgroundColor = [UIColor lightGrayColor];
77 | intValueLabel.font = [UIFont systemFontOfSize:15.0];
78 | intValueLabel.textAlignment = NSTextAlignmentCenter;
79 | [self.view addSubview:intValueLabel];
80 | _intValueLabel = intValueLabel;
81 | }
82 | return _intValueLabel;
83 | }
84 |
85 | - (UILabel *)floatValueLabel {
86 | if (!_floatValueLabel) {
87 | UILabel *floatValueLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(self.floatValueSlider.frame)+10, kSCREENW-20, 44)];
88 | floatValueLabel.textColor = [UIColor whiteColor];
89 | floatValueLabel.backgroundColor = [UIColor lightGrayColor];
90 | floatValueLabel.font = [UIFont systemFontOfSize:15.0];
91 | floatValueLabel.textAlignment = NSTextAlignmentCenter;
92 | [self.view addSubview:floatValueLabel];
93 | _floatValueLabel = floatValueLabel;
94 | }
95 | return _floatValueLabel;
96 | }
97 |
98 | @end
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/xcuserdata/test.xcuserdatad/xcschemes/GWLCustomSlider.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/xcuserdata/gaowanli.xcuserdatad/xcschemes/GWLCustomSlider.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/GWLCustomSlider/GWLCustomSlider.m:
--------------------------------------------------------------------------------
1 | //
2 | // GWLCustomSlider.m
3 | // GWLCustomSlider
4 | //
5 | // Created by 高万里 on 15/6/6.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import "GWLCustomSlider.h"
10 | #import "UIView+Add.h"
11 |
12 | #define kPADDING 0.5 // 按钮间距
13 | #define kMARGIN 10 // 边距
14 | @interface GWLCustomSlider ()
15 |
16 | @property(nonatomic,strong)NSArray *titleArray;
17 | /**min按钮默认显示的下标*/
18 | @property(nonatomic,assign)NSInteger defalutMinValueIndex;
19 | /**max按钮默认显示的下标*/
20 | @property(nonatomic,assign)NSInteger defalutMaxValueIndex;
21 | /**最小值和最大值是否可以一样*/
22 | @property(nonatomic,assign)BOOL minMaxCanSame;
23 |
24 | @property(nonatomic,weak)UIView *sliderView;
25 | @property(nonatomic,weak)UIButton *minSliderButton;
26 | @property(nonatomic,weak)UIButton *maxSliderButton;
27 | /**标题Label数组*/
28 | @property(nonatomic,strong)NSMutableArray *titleLabelArray;
29 | /**一个刻度的长度*/
30 | @property(nonatomic,assign)CGFloat scale;
31 |
32 | @end
33 |
34 | @implementation GWLCustomSlider
35 |
36 | + (instancetype)customSliderWithTitleArray:(NSArray *)titleArray withDefalutMinValueIndex:(NSInteger)defalutMinValueIndex withDefalutMaxValueIndex:(NSInteger)defalutMaxValueIndex andMinMaxCanSame:(BOOL)minMaxCanSame {
37 | return [[self alloc]initWithTitleArray:titleArray withDefalutMinValueIndex:defalutMinValueIndex withDefalutMaxValueIndex:defalutMaxValueIndex andMinMaxCanSame:minMaxCanSame];
38 | }
39 |
40 | - (instancetype)initWithTitleArray:(NSArray *)titleArray withDefalutMinValueIndex:(NSInteger)defalutMinValueIndex withDefalutMaxValueIndex:(NSInteger)defalutMaxValueIndex andMinMaxCanSame:(BOOL)minMaxCanSame {
41 | if (self = [super init]) {
42 | self.backgroundColor = [UIColor lightGrayColor];
43 | [self makeSubviews];
44 | _defalutMinValueIndex = defalutMinValueIndex;
45 | _defalutMaxValueIndex = defalutMaxValueIndex;
46 | _minMaxCanSame = minMaxCanSame;
47 | self.titleArray = titleArray;
48 | }
49 | return self;
50 | }
51 |
52 | - (void)makeSubviews {
53 | UIView *sliderView = [[UIView alloc]init];
54 | sliderView.backgroundColor = [UIColor grayColor];
55 | [self addSubview:sliderView];
56 | self.sliderView = sliderView;
57 |
58 | UIButton *minSliderButton = [[UIButton alloc]init];
59 | minSliderButton.backgroundColor = [UIColor whiteColor];
60 | [minSliderButton setImage:[UIImage imageNamed:@"blue"] forState:UIControlStateNormal];
61 | [minSliderButton setImage:[UIImage imageNamed:@"blue"] forState:UIControlStateHighlighted];
62 | [minSliderButton setImage:[UIImage imageNamed:@"blue"] forState:UIControlStateSelected];
63 | minSliderButton.showsTouchWhenHighlighted = YES;
64 | UIPanGestureRecognizer *minSliderButtonPanGestureRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panMinSliderButton:)];
65 | [minSliderButton addGestureRecognizer:minSliderButtonPanGestureRecognizer];
66 | [sliderView addSubview:minSliderButton];
67 | self.minSliderButton = minSliderButton;
68 |
69 | UIButton *maxSliderButton = [[UIButton alloc]init];
70 | maxSliderButton.backgroundColor = [UIColor whiteColor];
71 | [maxSliderButton setImage:[UIImage imageNamed:@"red"] forState:UIControlStateNormal];
72 | [maxSliderButton setImage:[UIImage imageNamed:@"red"] forState:UIControlStateHighlighted];
73 | [maxSliderButton setImage:[UIImage imageNamed:@"red"] forState:UIControlStateSelected];
74 | maxSliderButton.showsTouchWhenHighlighted = YES;
75 | UIPanGestureRecognizer *maxSliderButtonPanGestureRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panMaxSliderButton:)];
76 | [maxSliderButton addGestureRecognizer:maxSliderButtonPanGestureRecognizer];
77 | [sliderView addSubview:maxSliderButton];
78 | self.maxSliderButton = maxSliderButton;
79 | }
80 |
81 | - (void)setTitleArray:(NSArray *)titleArray {
82 | _titleArray = titleArray;
83 | for (NSString *title in _titleArray) {
84 | UILabel *titleLabel = [[UILabel alloc]init];
85 | titleLabel.backgroundColor = [UIColor whiteColor];
86 | titleLabel.textColor = [UIColor lightGrayColor];
87 | titleLabel.font = [UIFont systemFontOfSize:12.0f];
88 | titleLabel.textAlignment = NSTextAlignmentCenter;
89 | titleLabel.text = title;
90 | [self addSubview:titleLabel];
91 | [self.titleLabelArray addObject:titleLabel];
92 | }
93 | }
94 |
95 | - (void)layoutSubviews {
96 | [super layoutSubviews];
97 |
98 | NSInteger titleLabelCount = self.titleLabelArray.count;
99 |
100 | if (titleLabelCount == 0) {
101 | return;
102 | }
103 |
104 | CGFloat contentW = self.width-2*kMARGIN; // 内容宽度
105 | CGFloat titleLabelW = (contentW-(titleLabelCount-1)*kPADDING)/titleLabelCount;
106 | self.scale = titleLabelW;// 每个刻度的宽度
107 | UILabel *lastLabel;
108 | for (NSInteger index = 0; index < titleLabelCount; index++ ) {
109 | UILabel *titleLabel = self.titleLabelArray[index];
110 | titleLabel.X = kMARGIN + index*(titleLabelW+kPADDING);
111 | titleLabel.Y = kMARGIN;
112 | titleLabel.width = titleLabelW;
113 | titleLabel.height = 12;
114 | if (index == titleLabelCount-1) {
115 | lastLabel = titleLabel;
116 | }
117 | }
118 |
119 | CGFloat sliderViewH = 0;
120 | if (_minSliderButton.currentImage != nil) {
121 | sliderViewH = _minSliderButton.currentImage.size.height*(titleLabelW/_minSliderButton.currentImage.size.width);
122 | }
123 | _sliderView.frame = CGRectMake(kMARGIN, CGRectGetMaxY(lastLabel.frame)+kPADDING, contentW, sliderViewH);
124 |
125 | _minSliderButton.X = _defalutMinValueIndex*(titleLabelW+kPADDING);
126 | _minSliderButton.width = titleLabelW;
127 | _minSliderButton.height = sliderViewH;
128 |
129 | _maxSliderButton.frame = _minSliderButton.frame;
130 | _maxSliderButton.X = _defalutMaxValueIndex*(titleLabelW+kPADDING);
131 |
132 | self.height = CGRectGetMaxY(_sliderView.frame)+kMARGIN;
133 |
134 | [self valueChanged];
135 | }
136 |
137 | /**minSlider拖动事件*/
138 | - (void)panMinSliderButton:(UIPanGestureRecognizer *)pan {
139 | CGPoint panPoint = [pan translationInView:pan.view];
140 | [pan setTranslation:CGPointZero inView:pan.view];
141 |
142 | CGFloat toX = self.minSliderButton.X + panPoint.x;
143 | CGFloat panMaxX = 0;
144 | if (_minMaxCanSame) {
145 | panMaxX = self.maxSliderButton.X; // 可重叠
146 | }else {
147 | panMaxX = self.maxSliderButton.X-self.minSliderButton.width-kPADDING; // 不能重叠
148 | }
149 |
150 | int a = (int)ceil(toX/_scale); // 表示滑动了几个刻度的距离
151 | float b = (toX/_scale) - ((int)floor(toX/_scale));
152 | if (toX >= 0 && toX <= panMaxX) {
153 | self.minSliderButton.X = toX;
154 | }
155 | if (pan.state == UIGestureRecognizerStateEnded) {
156 | if (ABS(b) > 0.5) {
157 | toX = a*(_scale+kPADDING);
158 | }else {
159 | toX = (a-1)*(_scale+kPADDING);
160 | }
161 | if (toX >= 0 && toX <= panMaxX) {
162 | self.minSliderButton.X = toX;
163 | }else {
164 | if (toX < 0) {
165 | toX = 0;
166 | }else if (toX > panMaxX) {
167 | toX = panMaxX;
168 | }
169 | self.minSliderButton.X = toX;
170 | }
171 |
172 | if (self.minSliderButton.X == self.maxSliderButton.X) {
173 | [self.sliderView sendSubviewToBack:self.maxSliderButton];
174 | }
175 | [self valueChanged];
176 | }
177 | }
178 |
179 | /**maxSlider拖动事件*/
180 | - (void)panMaxSliderButton:(UIPanGestureRecognizer *)pan {
181 | CGPoint panPoint = [pan translationInView:pan.view];
182 | [pan setTranslation:CGPointZero inView:pan.view];
183 |
184 | CGFloat toX = self.maxSliderButton.X + panPoint.x;
185 | CGFloat panMaxX = self.sliderView.width - self.maxSliderButton.width;
186 |
187 | CGFloat minX = 0;
188 | if (_minMaxCanSame) {
189 | minX = self.minSliderButton.X; // 可重叠
190 | }else {
191 | minX = CGRectGetMaxX(self.minSliderButton.frame)+kPADDING; // 不可重叠
192 | }
193 |
194 | int a = (int)ceil(toX/_scale); // 表示滑动了几个刻度的距离
195 | float b = (toX/_scale) - ((int)floor(toX/_scale));
196 | if (toX >= minX && toX <= panMaxX) {
197 | self.maxSliderButton.X = toX;
198 | }
199 | if (pan.state == UIGestureRecognizerStateEnded) {
200 | if (ABS(b) > 0.5) {
201 | toX = a*(_scale+kPADDING);
202 | }else {
203 | toX = (a-1)*(_scale+kPADDING);
204 | }
205 | if (toX >= minX && toX <= panMaxX) {
206 | self.self.maxSliderButton.X = toX;
207 | }else {
208 | if (toX < minX) {
209 | toX = 0;
210 | }else if (toX > panMaxX) {
211 | toX = panMaxX;
212 | }
213 | self.self.maxSliderButton.X = toX;
214 | }
215 | if (self.maxSliderButton.X == self.minSliderButton.X) {
216 | [self.sliderView sendSubviewToBack:self.minSliderButton];
217 | }
218 | [self valueChanged];
219 | }
220 | }
221 |
222 | - (void)valueChanged {
223 | if ([self.delegate respondsToSelector:@selector(customSliderValueChanged:minValue:maxValue:)]) {
224 | NSString *minValue = _titleArray[(int)(self.minSliderButton.X/(_scale+kPADDING))];
225 | NSString *maxValue = _titleArray[(int)(self.maxSliderButton.X/(_scale+kPADDING))];
226 | [self.delegate customSliderValueChanged:self minValue:minValue maxValue:maxValue];
227 | }
228 | }
229 |
230 | - (NSMutableArray *)titleLabelArray {
231 | if (!_titleLabelArray) {
232 | _titleLabelArray = [NSMutableArray array];
233 | }
234 | return _titleLabelArray;
235 | }
236 |
237 | @end
238 |
--------------------------------------------------------------------------------
/GWLCustomSlider/GWLCustomSliderNew.m:
--------------------------------------------------------------------------------
1 | //
2 | // GWLCustomSliderNew.m
3 | // GWLCustomSliderNew.m
4 | //
5 | // Created by 高万里 on 15/6/10.
6 | // Copyright (c) 2015年 高万里. All rights reserved.
7 | //
8 |
9 | #import "GWLCustomSliderNew.h"
10 | #import "UIView+Add.h"
11 |
12 | #define kMARGIN 10 // 边距
13 | #define kCOLORBLUE ([UIColor colorWithRed:69/255.0f green:135/255.0f blue:195/255.0f alpha:1.0])
14 |
15 | @interface GWLCustomSliderNew ()
16 |
17 | @property(nonatomic,strong)NSArray *titleArray;
18 | @property(nonatomic,assign)NSInteger defalutMinValue;
19 | @property(nonatomic,assign)NSInteger defalutMaxValue;
20 | /**最小值和最大值是否可以一样*/
21 | @property(nonatomic,assign)BOOL minMaxCanSame;
22 |
23 | @property(nonatomic,weak)UIView *sliderView;
24 | @property(nonatomic,weak)UILabel *backgroundIndicatorLabel;
25 | @property(nonatomic,weak)UILabel *indicatorLabel;
26 | @property(nonatomic,weak)UIButton *minSliderButton;
27 | @property(nonatomic,weak)UIButton *maxSliderButton;
28 | /**标题Label数组*/
29 | @property(nonatomic,strong)NSMutableArray *titleLabelArray;
30 | /**一个刻度的长度*/
31 | @property(nonatomic,assign)CGFloat scale;
32 | /**完成了一次布局*/
33 | @property(nonatomic,assign)BOOL layoutOnceDone;
34 |
35 | @end
36 |
37 | @implementation GWLCustomSliderNew
38 |
39 | + (instancetype)customSliderWithDefalutMinValue:(float)defalutMinValue withDefalutMaxValue:(float)defalutMaxValue andMinMaxCanSame:(BOOL)minMaxCanSame{
40 | return [[self alloc]initWithDefalutMinValue:defalutMinValue withDefalutMaxValue:defalutMaxValue andMinMaxCanSame:minMaxCanSame];
41 | }
42 |
43 | - (instancetype)initWithDefalutMinValue:(float)defalutMinValue withDefalutMaxValue:(float)defalutMaxValue andMinMaxCanSame:(BOOL)minMaxCanSame {
44 | if (self = [super init]) {
45 | [self makeSubviews];
46 | self.backgroundColor = [UIColor whiteColor];
47 | _defalutMinValue = defalutMinValue;
48 | _defalutMaxValue = defalutMaxValue;
49 | _minMaxCanSame = minMaxCanSame;
50 | }
51 | return self;
52 | }
53 |
54 | - (void)makeSubviews {
55 | for (NSString *title in self.titleArray) {
56 | UILabel *titleLabel = [[UILabel alloc]init];
57 | titleLabel.textColor = [UIColor lightGrayColor];
58 | titleLabel.font = [UIFont systemFontOfSize:12.0f];
59 | titleLabel.textAlignment = NSTextAlignmentCenter;
60 | titleLabel.text = title;
61 | [self addSubview:titleLabel];
62 | [self.titleLabelArray addObject:titleLabel];
63 | }
64 |
65 | UIView *sliderView = [[UIView alloc]init];
66 | [self addSubview:sliderView];
67 | self.sliderView = sliderView;
68 |
69 | UILabel *backgroundIndicatorLabel = [[UILabel alloc]init];
70 | backgroundIndicatorLabel.backgroundColor = [UIColor lightGrayColor];
71 | [self addSubview:backgroundIndicatorLabel];
72 | self.backgroundIndicatorLabel = backgroundIndicatorLabel;
73 |
74 | UILabel *indicatorLabel = [[UILabel alloc]init];
75 | indicatorLabel.backgroundColor = kCOLORBLUE;
76 | [self addSubview:indicatorLabel];
77 | self.indicatorLabel = indicatorLabel;
78 |
79 | UIButton *minSliderButton = [[UIButton alloc]init];
80 | [minSliderButton setImage:[UIImage imageNamed:@"icon_jiage.png"] forState:UIControlStateNormal];
81 | [minSliderButton setImage:[UIImage imageNamed:@"icon_jiage.png"] forState:UIControlStateHighlighted];
82 | [minSliderButton setImage:[UIImage imageNamed:@"icon_jiage.png"] forState:UIControlStateSelected];
83 | UIPanGestureRecognizer *minSliderButtonPanGestureRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panMinSliderButton:)];
84 | [minSliderButton addGestureRecognizer:minSliderButtonPanGestureRecognizer];
85 | [sliderView addSubview:minSliderButton];
86 | self.minSliderButton = minSliderButton;
87 |
88 | UIButton *maxSliderButton = [[UIButton alloc]init];
89 | [maxSliderButton setImage:[UIImage imageNamed:@"icon_jiage.png"] forState:UIControlStateNormal];
90 | [maxSliderButton setImage:[UIImage imageNamed:@"icon_jiage.png"] forState:UIControlStateHighlighted];
91 | [maxSliderButton setImage:[UIImage imageNamed:@"icon_jiage.png"] forState:UIControlStateSelected];
92 | UIPanGestureRecognizer *maxSliderButtonPanGestureRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panMaxSliderButton:)];
93 | [maxSliderButton addGestureRecognizer:maxSliderButtonPanGestureRecognizer];
94 | [sliderView addSubview:maxSliderButton];
95 | self.maxSliderButton = maxSliderButton;
96 | }
97 |
98 | - (void)layoutSubviews {
99 | [super layoutSubviews];
100 | if (_layoutOnceDone) {
101 | return;
102 | }
103 | NSInteger titleLabelCount = self.titleLabelArray.count;
104 |
105 | CGFloat contentW = self.width-2*kMARGIN; // 内容宽度
106 | CGFloat titleLabelW = contentW/titleLabelCount;
107 | self.scale = titleLabelW;// 每个刻度的宽度
108 | UILabel *lastLabel;
109 | for (NSInteger index = 0; index < titleLabelCount; index++ ) {
110 | UILabel *titleLabel = self.titleLabelArray[index];
111 | titleLabel.X = kMARGIN + index*titleLabelW;
112 | titleLabel.Y = kMARGIN;
113 | titleLabel.width = titleLabelW;
114 | titleLabel.height = 12;
115 | if (index == titleLabelCount-1) {
116 | lastLabel = titleLabel;
117 | }
118 | }
119 |
120 | CGFloat labelW = contentW - _scale*0.5*2;
121 | _backgroundIndicatorLabel.frame = CGRectMake(kMARGIN+_scale*0.5, CGRectGetMaxY(lastLabel.frame)+4, labelW, 4);
122 | _backgroundIndicatorLabel.layer.cornerRadius = _backgroundIndicatorLabel.height*0.5;
123 | _backgroundIndicatorLabel.layer.masksToBounds = YES;
124 | _indicatorLabel.Y = _backgroundIndicatorLabel.Y;
125 | _indicatorLabel.size = _backgroundIndicatorLabel.size;
126 | _indicatorLabel.layer.cornerRadius = _indicatorLabel.height*0.5;
127 | _indicatorLabel.layer.masksToBounds = YES;
128 |
129 | CGFloat sliderViewH = 0;
130 | if (_minSliderButton.currentImage != nil) {
131 | sliderViewH = _minSliderButton.currentImage.size.height*(titleLabelW/_minSliderButton.currentImage.size.width);
132 | }
133 | _sliderView.frame = CGRectMake(kMARGIN, CGRectGetMaxY(_backgroundIndicatorLabel.frame), contentW, sliderViewH);
134 |
135 | _minSliderButton.X = _defalutMinValue*_scale*0.1;
136 | _minSliderButton.width = titleLabelW;
137 | _minSliderButton.height = sliderViewH;
138 |
139 | _maxSliderButton.frame = _minSliderButton.frame;
140 | _maxSliderButton.X = _defalutMaxValue*_scale*0.1;
141 |
142 | [self configureIndicatorLableXW];
143 |
144 | [self valueChanged];
145 | }
146 |
147 | /**minSlider拖动事件*/
148 | - (void)panMinSliderButton:(UIPanGestureRecognizer *)pan {
149 | CGPoint panPoint = [pan translationInView:pan.view];
150 | [pan setTranslation:CGPointZero inView:pan.view];
151 |
152 | NSInteger toX = ceil(self.minSliderButton.X + panPoint.x);
153 | CGFloat panMaxX = 0;
154 | if (_minMaxCanSame) {
155 | panMaxX = self.maxSliderButton.X; // 可重叠
156 | }else {
157 | panMaxX = self.maxSliderButton.X-self.minSliderButton.width; // 不能重叠
158 | }
159 |
160 | if (toX >= 0 && toX <= panMaxX) {
161 | self.minSliderButton.X = toX;
162 | }
163 |
164 | if (pan.state == UIGestureRecognizerStateChanged) {
165 | [self valueChanged];
166 | }else if (pan.state == UIGestureRecognizerStateEnded) {
167 | if (self.minSliderButton.X == self.maxSliderButton.X) {
168 | [self.sliderView sendSubviewToBack:self.maxSliderButton];
169 | }
170 | }
171 | }
172 |
173 | /**maxSlider拖动事件*/
174 | - (void)panMaxSliderButton:(UIPanGestureRecognizer *)pan {
175 | CGPoint panPoint = [pan translationInView:pan.view];
176 | [pan setTranslation:CGPointZero inView:pan.view];
177 |
178 | NSInteger toX = ceil(self.maxSliderButton.X + panPoint.x);
179 | CGFloat panMaxX = self.sliderView.width - self.maxSliderButton.width;
180 |
181 | CGFloat minX = 0;
182 | if (_minMaxCanSame) {
183 | minX = self.minSliderButton.X; // 可重叠
184 | }else {
185 | minX = CGRectGetMaxX(self.minSliderButton.frame); // 不可重叠
186 | }
187 |
188 | if (toX >= minX && toX <= panMaxX) {
189 | self.maxSliderButton.X = toX;
190 | }
191 |
192 | if (pan.state == UIGestureRecognizerStateChanged) {
193 | [self valueChanged];
194 | }else if (pan.state == UIGestureRecognizerStateEnded) {
195 | if (self.maxSliderButton.X == self.minSliderButton.X) {
196 | [self.sliderView sendSubviewToBack:self.minSliderButton];
197 | }
198 | }
199 | }
200 |
201 | - (void)valueChanged {
202 |
203 | [self configureIndicatorLableXW];
204 |
205 | CGFloat minX = self.minSliderButton.X;
206 | NSInteger minValue = ceil(minX/_scale*10);
207 |
208 | CGFloat maxX = self.maxSliderButton.X;
209 | NSInteger maxValue = ceil(maxX/_scale*10);
210 |
211 | if ([self.delegate respondsToSelector:@selector(customSliderValueChanged:minValue:maxValue:)]) {
212 | [self.delegate customSliderValueChanged:self minValue:[NSString stringWithFormat:@"%zd.0",minValue] maxValue:[NSString stringWithFormat:@"%zd.0",maxValue]];
213 | }
214 | }
215 |
216 | /**设置指示条的范围*/
217 | - (void)configureIndicatorLableXW
218 | {
219 | CGFloat indicatorMinX = self.minSliderButton.X+_scale*0.5;
220 | self.indicatorLabel.X = kMARGIN+indicatorMinX;
221 | self.indicatorLabel.width = CGRectGetMaxX(self.maxSliderButton.frame)-_scale*0.5-indicatorMinX;
222 | _layoutOnceDone = YES;
223 | }
224 |
225 | #pragma mark - layz laoding
226 | - (NSArray *)titleArray {
227 | if (!_titleArray) {
228 | _titleArray = @[@"0",@"10",@"20",@"30",@"40",@"50",@"60",@"70",@"80",@"90",@"100"];
229 | }
230 | return _titleArray;
231 | }
232 |
233 | - (NSMutableArray *)titleLabelArray {
234 | if (!_titleLabelArray) {
235 | _titleLabelArray = [NSMutableArray array];
236 | }
237 | return _titleLabelArray;
238 | }
239 |
240 | @end
241 |
--------------------------------------------------------------------------------
/GWLCustomSlider.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 52DC7C801B29771500E01486 /* GWLCustomSliderNew.m in Sources */ = {isa = PBXBuildFile; fileRef = 52DC7C7F1B29771500E01486 /* GWLCustomSliderNew.m */; };
11 | 52DC7C831B2977CE00E01486 /* UIView+Add.m in Sources */ = {isa = PBXBuildFile; fileRef = 52DC7C821B2977CE00E01486 /* UIView+Add.m */; };
12 | 52DC7C861B297AC300E01486 /* DemoNewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 52DC7C851B297AC300E01486 /* DemoNewViewController.m */; };
13 | AD5788381B2420250059FDF7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AD5788371B2420250059FDF7 /* main.m */; };
14 | AD57883B1B2420250059FDF7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AD57883A1B2420250059FDF7 /* AppDelegate.m */; };
15 | AD57883E1B2420250059FDF7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AD57883D1B2420250059FDF7 /* ViewController.m */; };
16 | AD5788431B2420250059FDF7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AD5788421B2420250059FDF7 /* Images.xcassets */; };
17 | AD5788521B2420260059FDF7 /* GWLCustomSliderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AD5788511B2420260059FDF7 /* GWLCustomSliderTests.m */; };
18 | AD57885D1B2420A70059FDF7 /* DemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AD57885C1B2420A70059FDF7 /* DemoViewController.m */; };
19 | AD5788611B2420C60059FDF7 /* GWLCustomSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = AD5788601B2420C60059FDF7 /* GWLCustomSlider.m */; };
20 | /* End PBXBuildFile section */
21 |
22 | /* Begin PBXContainerItemProxy section */
23 | AD57884C1B2420260059FDF7 /* PBXContainerItemProxy */ = {
24 | isa = PBXContainerItemProxy;
25 | containerPortal = AD57882A1B2420250059FDF7 /* Project object */;
26 | proxyType = 1;
27 | remoteGlobalIDString = AD5788311B2420250059FDF7;
28 | remoteInfo = GWLCustomSlider;
29 | };
30 | /* End PBXContainerItemProxy section */
31 |
32 | /* Begin PBXFileReference section */
33 | 52DC7C7E1B29771500E01486 /* GWLCustomSliderNew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GWLCustomSliderNew.h; sourceTree = ""; };
34 | 52DC7C7F1B29771500E01486 /* GWLCustomSliderNew.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GWLCustomSliderNew.m; sourceTree = ""; };
35 | 52DC7C811B2977CE00E01486 /* UIView+Add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Add.h"; sourceTree = ""; };
36 | 52DC7C821B2977CE00E01486 /* UIView+Add.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Add.m"; sourceTree = ""; };
37 | 52DC7C841B297AC300E01486 /* DemoNewViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoNewViewController.h; sourceTree = ""; };
38 | 52DC7C851B297AC300E01486 /* DemoNewViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoNewViewController.m; sourceTree = ""; };
39 | AD5788321B2420250059FDF7 /* GWLCustomSlider.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GWLCustomSlider.app; sourceTree = BUILT_PRODUCTS_DIR; };
40 | AD5788361B2420250059FDF7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
41 | AD5788371B2420250059FDF7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
42 | AD5788391B2420250059FDF7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
43 | AD57883A1B2420250059FDF7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
44 | AD57883C1B2420250059FDF7 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
45 | AD57883D1B2420250059FDF7 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
46 | AD5788421B2420250059FDF7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
47 | AD57884B1B2420260059FDF7 /* GWLCustomSliderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GWLCustomSliderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
48 | AD5788501B2420260059FDF7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | AD5788511B2420260059FDF7 /* GWLCustomSliderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GWLCustomSliderTests.m; sourceTree = ""; };
50 | AD57885B1B2420A70059FDF7 /* DemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoViewController.h; sourceTree = ""; };
51 | AD57885C1B2420A70059FDF7 /* DemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoViewController.m; sourceTree = ""; };
52 | AD57885E1B2420B80059FDF7 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; };
53 | AD57885F1B2420C60059FDF7 /* GWLCustomSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GWLCustomSlider.h; sourceTree = ""; };
54 | AD5788601B2420C60059FDF7 /* GWLCustomSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GWLCustomSlider.m; sourceTree = ""; };
55 | /* End PBXFileReference section */
56 |
57 | /* Begin PBXFrameworksBuildPhase section */
58 | AD57882F1B2420250059FDF7 /* Frameworks */ = {
59 | isa = PBXFrameworksBuildPhase;
60 | buildActionMask = 2147483647;
61 | files = (
62 | );
63 | runOnlyForDeploymentPostprocessing = 0;
64 | };
65 | AD5788481B2420260059FDF7 /* Frameworks */ = {
66 | isa = PBXFrameworksBuildPhase;
67 | buildActionMask = 2147483647;
68 | files = (
69 | );
70 | runOnlyForDeploymentPostprocessing = 0;
71 | };
72 | /* End PBXFrameworksBuildPhase section */
73 |
74 | /* Begin PBXGroup section */
75 | AD5788291B2420250059FDF7 = {
76 | isa = PBXGroup;
77 | children = (
78 | AD5788341B2420250059FDF7 /* GWLCustomSlider */,
79 | AD57884E1B2420260059FDF7 /* GWLCustomSliderTests */,
80 | AD5788331B2420250059FDF7 /* Products */,
81 | );
82 | sourceTree = "";
83 | };
84 | AD5788331B2420250059FDF7 /* Products */ = {
85 | isa = PBXGroup;
86 | children = (
87 | AD5788321B2420250059FDF7 /* GWLCustomSlider.app */,
88 | AD57884B1B2420260059FDF7 /* GWLCustomSliderTests.xctest */,
89 | );
90 | name = Products;
91 | sourceTree = "";
92 | };
93 | AD5788341B2420250059FDF7 /* GWLCustomSlider */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 52DC7C811B2977CE00E01486 /* UIView+Add.h */,
97 | 52DC7C821B2977CE00E01486 /* UIView+Add.m */,
98 | AD5788391B2420250059FDF7 /* AppDelegate.h */,
99 | AD57883A1B2420250059FDF7 /* AppDelegate.m */,
100 | AD57883C1B2420250059FDF7 /* ViewController.h */,
101 | AD57883D1B2420250059FDF7 /* ViewController.m */,
102 | AD57885B1B2420A70059FDF7 /* DemoViewController.h */,
103 | AD57885C1B2420A70059FDF7 /* DemoViewController.m */,
104 | 52DC7C841B297AC300E01486 /* DemoNewViewController.h */,
105 | 52DC7C851B297AC300E01486 /* DemoNewViewController.m */,
106 | AD5788351B2420250059FDF7 /* Supporting Files */,
107 | AD57885F1B2420C60059FDF7 /* GWLCustomSlider.h */,
108 | AD5788601B2420C60059FDF7 /* GWLCustomSlider.m */,
109 | 52DC7C7E1B29771500E01486 /* GWLCustomSliderNew.h */,
110 | 52DC7C7F1B29771500E01486 /* GWLCustomSliderNew.m */,
111 | );
112 | path = GWLCustomSlider;
113 | sourceTree = "";
114 | };
115 | AD5788351B2420250059FDF7 /* Supporting Files */ = {
116 | isa = PBXGroup;
117 | children = (
118 | AD57885E1B2420B80059FDF7 /* PrefixHeader.pch */,
119 | AD5788421B2420250059FDF7 /* Images.xcassets */,
120 | AD5788361B2420250059FDF7 /* Info.plist */,
121 | AD5788371B2420250059FDF7 /* main.m */,
122 | );
123 | name = "Supporting Files";
124 | sourceTree = "";
125 | };
126 | AD57884E1B2420260059FDF7 /* GWLCustomSliderTests */ = {
127 | isa = PBXGroup;
128 | children = (
129 | AD5788511B2420260059FDF7 /* GWLCustomSliderTests.m */,
130 | AD57884F1B2420260059FDF7 /* Supporting Files */,
131 | );
132 | path = GWLCustomSliderTests;
133 | sourceTree = "";
134 | };
135 | AD57884F1B2420260059FDF7 /* Supporting Files */ = {
136 | isa = PBXGroup;
137 | children = (
138 | AD5788501B2420260059FDF7 /* Info.plist */,
139 | );
140 | name = "Supporting Files";
141 | sourceTree = "";
142 | };
143 | /* End PBXGroup section */
144 |
145 | /* Begin PBXNativeTarget section */
146 | AD5788311B2420250059FDF7 /* GWLCustomSlider */ = {
147 | isa = PBXNativeTarget;
148 | buildConfigurationList = AD5788551B2420260059FDF7 /* Build configuration list for PBXNativeTarget "GWLCustomSlider" */;
149 | buildPhases = (
150 | AD57882E1B2420250059FDF7 /* Sources */,
151 | AD57882F1B2420250059FDF7 /* Frameworks */,
152 | AD5788301B2420250059FDF7 /* Resources */,
153 | );
154 | buildRules = (
155 | );
156 | dependencies = (
157 | );
158 | name = GWLCustomSlider;
159 | productName = GWLCustomSlider;
160 | productReference = AD5788321B2420250059FDF7 /* GWLCustomSlider.app */;
161 | productType = "com.apple.product-type.application";
162 | };
163 | AD57884A1B2420260059FDF7 /* GWLCustomSliderTests */ = {
164 | isa = PBXNativeTarget;
165 | buildConfigurationList = AD5788581B2420260059FDF7 /* Build configuration list for PBXNativeTarget "GWLCustomSliderTests" */;
166 | buildPhases = (
167 | AD5788471B2420260059FDF7 /* Sources */,
168 | AD5788481B2420260059FDF7 /* Frameworks */,
169 | AD5788491B2420260059FDF7 /* Resources */,
170 | );
171 | buildRules = (
172 | );
173 | dependencies = (
174 | AD57884D1B2420260059FDF7 /* PBXTargetDependency */,
175 | );
176 | name = GWLCustomSliderTests;
177 | productName = GWLCustomSliderTests;
178 | productReference = AD57884B1B2420260059FDF7 /* GWLCustomSliderTests.xctest */;
179 | productType = "com.apple.product-type.bundle.unit-test";
180 | };
181 | /* End PBXNativeTarget section */
182 |
183 | /* Begin PBXProject section */
184 | AD57882A1B2420250059FDF7 /* Project object */ = {
185 | isa = PBXProject;
186 | attributes = {
187 | LastUpgradeCheck = 0630;
188 | ORGANIZATIONNAME = "高万里";
189 | TargetAttributes = {
190 | AD5788311B2420250059FDF7 = {
191 | CreatedOnToolsVersion = 6.3.1;
192 | };
193 | AD57884A1B2420260059FDF7 = {
194 | CreatedOnToolsVersion = 6.3.1;
195 | TestTargetID = AD5788311B2420250059FDF7;
196 | };
197 | };
198 | };
199 | buildConfigurationList = AD57882D1B2420250059FDF7 /* Build configuration list for PBXProject "GWLCustomSlider" */;
200 | compatibilityVersion = "Xcode 3.2";
201 | developmentRegion = English;
202 | hasScannedForEncodings = 0;
203 | knownRegions = (
204 | en,
205 | Base,
206 | );
207 | mainGroup = AD5788291B2420250059FDF7;
208 | productRefGroup = AD5788331B2420250059FDF7 /* Products */;
209 | projectDirPath = "";
210 | projectRoot = "";
211 | targets = (
212 | AD5788311B2420250059FDF7 /* GWLCustomSlider */,
213 | AD57884A1B2420260059FDF7 /* GWLCustomSliderTests */,
214 | );
215 | };
216 | /* End PBXProject section */
217 |
218 | /* Begin PBXResourcesBuildPhase section */
219 | AD5788301B2420250059FDF7 /* Resources */ = {
220 | isa = PBXResourcesBuildPhase;
221 | buildActionMask = 2147483647;
222 | files = (
223 | AD5788431B2420250059FDF7 /* Images.xcassets in Resources */,
224 | );
225 | runOnlyForDeploymentPostprocessing = 0;
226 | };
227 | AD5788491B2420260059FDF7 /* Resources */ = {
228 | isa = PBXResourcesBuildPhase;
229 | buildActionMask = 2147483647;
230 | files = (
231 | );
232 | runOnlyForDeploymentPostprocessing = 0;
233 | };
234 | /* End PBXResourcesBuildPhase section */
235 |
236 | /* Begin PBXSourcesBuildPhase section */
237 | AD57882E1B2420250059FDF7 /* Sources */ = {
238 | isa = PBXSourcesBuildPhase;
239 | buildActionMask = 2147483647;
240 | files = (
241 | 52DC7C861B297AC300E01486 /* DemoNewViewController.m in Sources */,
242 | AD57883E1B2420250059FDF7 /* ViewController.m in Sources */,
243 | AD5788611B2420C60059FDF7 /* GWLCustomSlider.m in Sources */,
244 | AD57883B1B2420250059FDF7 /* AppDelegate.m in Sources */,
245 | 52DC7C801B29771500E01486 /* GWLCustomSliderNew.m in Sources */,
246 | 52DC7C831B2977CE00E01486 /* UIView+Add.m in Sources */,
247 | AD5788381B2420250059FDF7 /* main.m in Sources */,
248 | AD57885D1B2420A70059FDF7 /* DemoViewController.m in Sources */,
249 | );
250 | runOnlyForDeploymentPostprocessing = 0;
251 | };
252 | AD5788471B2420260059FDF7 /* Sources */ = {
253 | isa = PBXSourcesBuildPhase;
254 | buildActionMask = 2147483647;
255 | files = (
256 | AD5788521B2420260059FDF7 /* GWLCustomSliderTests.m in Sources */,
257 | );
258 | runOnlyForDeploymentPostprocessing = 0;
259 | };
260 | /* End PBXSourcesBuildPhase section */
261 |
262 | /* Begin PBXTargetDependency section */
263 | AD57884D1B2420260059FDF7 /* PBXTargetDependency */ = {
264 | isa = PBXTargetDependency;
265 | target = AD5788311B2420250059FDF7 /* GWLCustomSlider */;
266 | targetProxy = AD57884C1B2420260059FDF7 /* PBXContainerItemProxy */;
267 | };
268 | /* End PBXTargetDependency section */
269 |
270 | /* Begin XCBuildConfiguration section */
271 | AD5788531B2420260059FDF7 /* Debug */ = {
272 | isa = XCBuildConfiguration;
273 | buildSettings = {
274 | ALWAYS_SEARCH_USER_PATHS = NO;
275 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
276 | CLANG_CXX_LIBRARY = "libc++";
277 | CLANG_ENABLE_MODULES = YES;
278 | CLANG_ENABLE_OBJC_ARC = YES;
279 | CLANG_WARN_BOOL_CONVERSION = YES;
280 | CLANG_WARN_CONSTANT_CONVERSION = YES;
281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
282 | CLANG_WARN_EMPTY_BODY = YES;
283 | CLANG_WARN_ENUM_CONVERSION = YES;
284 | CLANG_WARN_INT_CONVERSION = YES;
285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
286 | CLANG_WARN_UNREACHABLE_CODE = YES;
287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
288 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
289 | COPY_PHASE_STRIP = NO;
290 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
291 | ENABLE_STRICT_OBJC_MSGSEND = YES;
292 | GCC_C_LANGUAGE_STANDARD = gnu99;
293 | GCC_DYNAMIC_NO_PIC = NO;
294 | GCC_NO_COMMON_BLOCKS = YES;
295 | GCC_OPTIMIZATION_LEVEL = 0;
296 | GCC_PREPROCESSOR_DEFINITIONS = (
297 | "DEBUG=1",
298 | "$(inherited)",
299 | );
300 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
301 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
302 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
303 | GCC_WARN_UNDECLARED_SELECTOR = YES;
304 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
305 | GCC_WARN_UNUSED_FUNCTION = YES;
306 | GCC_WARN_UNUSED_VARIABLE = YES;
307 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
308 | MTL_ENABLE_DEBUG_INFO = YES;
309 | ONLY_ACTIVE_ARCH = YES;
310 | SDKROOT = iphoneos;
311 | };
312 | name = Debug;
313 | };
314 | AD5788541B2420260059FDF7 /* Release */ = {
315 | isa = XCBuildConfiguration;
316 | buildSettings = {
317 | ALWAYS_SEARCH_USER_PATHS = NO;
318 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
319 | CLANG_CXX_LIBRARY = "libc++";
320 | CLANG_ENABLE_MODULES = YES;
321 | CLANG_ENABLE_OBJC_ARC = YES;
322 | CLANG_WARN_BOOL_CONVERSION = YES;
323 | CLANG_WARN_CONSTANT_CONVERSION = YES;
324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
325 | CLANG_WARN_EMPTY_BODY = YES;
326 | CLANG_WARN_ENUM_CONVERSION = YES;
327 | CLANG_WARN_INT_CONVERSION = YES;
328 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
329 | CLANG_WARN_UNREACHABLE_CODE = YES;
330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
331 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
332 | COPY_PHASE_STRIP = NO;
333 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
334 | ENABLE_NS_ASSERTIONS = NO;
335 | ENABLE_STRICT_OBJC_MSGSEND = YES;
336 | GCC_C_LANGUAGE_STANDARD = gnu99;
337 | GCC_NO_COMMON_BLOCKS = YES;
338 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
339 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
340 | GCC_WARN_UNDECLARED_SELECTOR = YES;
341 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
342 | GCC_WARN_UNUSED_FUNCTION = YES;
343 | GCC_WARN_UNUSED_VARIABLE = YES;
344 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
345 | MTL_ENABLE_DEBUG_INFO = NO;
346 | SDKROOT = iphoneos;
347 | VALIDATE_PRODUCT = YES;
348 | };
349 | name = Release;
350 | };
351 | AD5788561B2420260059FDF7 /* Debug */ = {
352 | isa = XCBuildConfiguration;
353 | buildSettings = {
354 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
355 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
356 | GCC_PREFIX_HEADER = "$(SRCROOT)/GWLCustomSlider/PrefixHeader.pch";
357 | INFOPLIST_FILE = GWLCustomSlider/Info.plist;
358 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
359 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
360 | PRODUCT_NAME = "$(TARGET_NAME)";
361 | };
362 | name = Debug;
363 | };
364 | AD5788571B2420260059FDF7 /* Release */ = {
365 | isa = XCBuildConfiguration;
366 | buildSettings = {
367 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
368 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
369 | GCC_PREFIX_HEADER = "$(SRCROOT)/GWLCustomSlider/PrefixHeader.pch";
370 | INFOPLIST_FILE = GWLCustomSlider/Info.plist;
371 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
372 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
373 | PRODUCT_NAME = "$(TARGET_NAME)";
374 | };
375 | name = Release;
376 | };
377 | AD5788591B2420260059FDF7 /* Debug */ = {
378 | isa = XCBuildConfiguration;
379 | buildSettings = {
380 | BUNDLE_LOADER = "$(TEST_HOST)";
381 | FRAMEWORK_SEARCH_PATHS = (
382 | "$(SDKROOT)/Developer/Library/Frameworks",
383 | "$(inherited)",
384 | );
385 | GCC_PREPROCESSOR_DEFINITIONS = (
386 | "DEBUG=1",
387 | "$(inherited)",
388 | );
389 | INFOPLIST_FILE = GWLCustomSliderTests/Info.plist;
390 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
391 | PRODUCT_NAME = "$(TARGET_NAME)";
392 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GWLCustomSlider.app/GWLCustomSlider";
393 | };
394 | name = Debug;
395 | };
396 | AD57885A1B2420260059FDF7 /* Release */ = {
397 | isa = XCBuildConfiguration;
398 | buildSettings = {
399 | BUNDLE_LOADER = "$(TEST_HOST)";
400 | FRAMEWORK_SEARCH_PATHS = (
401 | "$(SDKROOT)/Developer/Library/Frameworks",
402 | "$(inherited)",
403 | );
404 | INFOPLIST_FILE = GWLCustomSliderTests/Info.plist;
405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
406 | PRODUCT_NAME = "$(TARGET_NAME)";
407 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GWLCustomSlider.app/GWLCustomSlider";
408 | };
409 | name = Release;
410 | };
411 | /* End XCBuildConfiguration section */
412 |
413 | /* Begin XCConfigurationList section */
414 | AD57882D1B2420250059FDF7 /* Build configuration list for PBXProject "GWLCustomSlider" */ = {
415 | isa = XCConfigurationList;
416 | buildConfigurations = (
417 | AD5788531B2420260059FDF7 /* Debug */,
418 | AD5788541B2420260059FDF7 /* Release */,
419 | );
420 | defaultConfigurationIsVisible = 0;
421 | defaultConfigurationName = Release;
422 | };
423 | AD5788551B2420260059FDF7 /* Build configuration list for PBXNativeTarget "GWLCustomSlider" */ = {
424 | isa = XCConfigurationList;
425 | buildConfigurations = (
426 | AD5788561B2420260059FDF7 /* Debug */,
427 | AD5788571B2420260059FDF7 /* Release */,
428 | );
429 | defaultConfigurationIsVisible = 0;
430 | defaultConfigurationName = Release;
431 | };
432 | AD5788581B2420260059FDF7 /* Build configuration list for PBXNativeTarget "GWLCustomSliderTests" */ = {
433 | isa = XCConfigurationList;
434 | buildConfigurations = (
435 | AD5788591B2420260059FDF7 /* Debug */,
436 | AD57885A1B2420260059FDF7 /* Release */,
437 | );
438 | defaultConfigurationIsVisible = 0;
439 | defaultConfigurationName = Release;
440 | };
441 | /* End XCConfigurationList section */
442 | };
443 | rootObject = AD57882A1B2420250059FDF7 /* Project object */;
444 | }
445 |
--------------------------------------------------------------------------------