├── Picture
├── photo1.png
├── photo2.png
├── PPNumberButton.png
├── PPNumberButton1.gif
└── PPNumberButton2.gif
├── PPNumberButton
├── Assets.xcassets
│ ├── Contents.json
│ ├── decrease_eleme.imageset
│ │ ├── decrease_eleme@2x.png
│ │ ├── decrease_eleme@3x.png
│ │ └── Contents.json
│ ├── increase_eleme.imageset
│ │ ├── increase_eleme@2x.png
│ │ ├── increase_eleme@3x.png
│ │ └── Contents.json
│ ├── decrease_meituan.imageset
│ │ ├── decrease_meituan@2x.png
│ │ ├── decrease_meituan@3x.png
│ │ └── Contents.json
│ ├── decrease_taobao.imageset
│ │ ├── decrease_taobao@2x.png
│ │ ├── decrease_taobao@3x.png
│ │ └── Contents.json
│ ├── increase_meituan.imageset
│ │ ├── increase_meituan@2x.png
│ │ ├── increase_meituan@3x.png
│ │ └── Contents.json
│ ├── increase_taobao.imageset
│ │ ├── increase_taobao@2x.png
│ │ ├── increase_taobao@3x.png
│ │ └── Contents.json
│ ├── decrease_baiduwaimai.imageset
│ │ ├── decrease_baiduwaimai@2x.png
│ │ ├── decrease_baiduwaimai@3x.png
│ │ └── Contents.json
│ ├── increase_baiduwaimai.imageset
│ │ ├── increase_baiduwaimai@2x.png
│ │ ├── increase_baiduwaimai@3x.png
│ │ └── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Controller
│ ├── PPViewController1.h
│ ├── PPViewController2.h
│ ├── PPViewController3.h
│ ├── PPHomePageController.h
│ ├── PPViewController2.m
│ ├── PPHomePageController.m
│ ├── PPViewController1.m
│ └── PPViewController3.m
├── AppDelegate.h
├── main.m
├── View
│ ├── PPTableViewCell.h
│ ├── PPTableViewCell.xib
│ └── PPTableViewCell.m
├── Info.plist
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── AppDelegate.m
└── PPNumberButton
│ ├── PPNumberButton.h
│ └── PPNumberButton.m
├── PPNumberButton.xcodeproj
├── xcuserdata
│ ├── YiAi.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── PPNumberButton.xcscheme
│ ├── AndyPang.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── PPNumberButton.xcscheme
│ └── duoyi.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── PPNumberButton.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ ├── YiAi.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── duoyi.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── AndyPang.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── project.pbxproj
├── PPNumberButton.podspec
├── PPNumberButtonTests
├── Info.plist
└── PPNumberButtonTests.m
├── LICENSE
├── .gitignore
└── README.md
/Picture/photo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/Picture/photo1.png
--------------------------------------------------------------------------------
/Picture/photo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/Picture/photo2.png
--------------------------------------------------------------------------------
/Picture/PPNumberButton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/Picture/PPNumberButton.png
--------------------------------------------------------------------------------
/Picture/PPNumberButton1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/Picture/PPNumberButton1.gif
--------------------------------------------------------------------------------
/Picture/PPNumberButton2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/Picture/PPNumberButton2.gif
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/YiAi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/AndyPang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_eleme.imageset/decrease_eleme@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/decrease_eleme.imageset/decrease_eleme@2x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_eleme.imageset/decrease_eleme@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/decrease_eleme.imageset/decrease_eleme@3x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_eleme.imageset/increase_eleme@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/increase_eleme.imageset/increase_eleme@2x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_eleme.imageset/increase_eleme@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/increase_eleme.imageset/increase_eleme@3x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_meituan.imageset/decrease_meituan@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/decrease_meituan.imageset/decrease_meituan@2x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_meituan.imageset/decrease_meituan@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/decrease_meituan.imageset/decrease_meituan@3x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_taobao.imageset/decrease_taobao@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/decrease_taobao.imageset/decrease_taobao@2x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_taobao.imageset/decrease_taobao@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/decrease_taobao.imageset/decrease_taobao@3x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_meituan.imageset/increase_meituan@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/increase_meituan.imageset/increase_meituan@2x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_meituan.imageset/increase_meituan@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/increase_meituan.imageset/increase_meituan@3x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_taobao.imageset/increase_taobao@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/increase_taobao.imageset/increase_taobao@2x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_taobao.imageset/increase_taobao@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/increase_taobao.imageset/increase_taobao@3x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_baiduwaimai.imageset/decrease_baiduwaimai@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/decrease_baiduwaimai.imageset/decrease_baiduwaimai@2x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_baiduwaimai.imageset/decrease_baiduwaimai@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/decrease_baiduwaimai.imageset/decrease_baiduwaimai@3x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_baiduwaimai.imageset/increase_baiduwaimai@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/increase_baiduwaimai.imageset/increase_baiduwaimai@2x.png
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_baiduwaimai.imageset/increase_baiduwaimai@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton/Assets.xcassets/increase_baiduwaimai.imageset/increase_baiduwaimai@3x.png
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/project.xcworkspace/xcuserdata/YiAi.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton.xcodeproj/project.xcworkspace/xcuserdata/YiAi.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/project.xcworkspace/xcuserdata/duoyi.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton.xcodeproj/project.xcworkspace/xcuserdata/duoyi.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/project.xcworkspace/xcuserdata/AndyPang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhengwenming/PPNumberButton/HEAD/PPNumberButton.xcodeproj/project.xcworkspace/xcuserdata/AndyPang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PPNumberButton/Controller/PPViewController1.h:
--------------------------------------------------------------------------------
1 | //
2 | // PPViewController1.h
3 | // PPNumberButton
4 | //
5 | // Created by YiAi on 2017/7/5.
6 | // Copyright © 2017年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PPViewController1 : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PPNumberButton/Controller/PPViewController2.h:
--------------------------------------------------------------------------------
1 | //
2 | // PPViewController2.h
3 | // PPNumberButton
4 | //
5 | // Created by YiAi on 2017/7/5.
6 | // Copyright © 2017年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PPViewController2 : UITableViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PPNumberButton/Controller/PPViewController3.h:
--------------------------------------------------------------------------------
1 | //
2 | // PPViewController3.h
3 | // PPNumberButton
4 | //
5 | // Created by zhengwenming on 2018/2/8.
6 | // Copyright © 2018年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PPViewController3 : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PPNumberButton/Controller/PPHomePageController.h:
--------------------------------------------------------------------------------
1 | //
2 | // PPHomePageController.h
3 | // PPNumberButton
4 | //
5 | // Created by YiAi on 2017/7/5.
6 | // Copyright © 2017年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PPHomePageController : UITableViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PPNumberButton/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PPNumberButton
4 | //
5 | // Created by AndyPang on 16/8/31.
6 | // Copyright © 2016年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/PPNumberButton/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PPNumberButton
4 | //
5 | // Created by AndyPang on 16/8/31.
6 | // Copyright © 2016年 AndyPang. 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 |
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_eleme.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "decrease_eleme@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "decrease_eleme@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_eleme.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "increase_eleme@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "increase_eleme@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_meituan.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "decrease_meituan@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "decrease_meituan@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_taobao.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "decrease_taobao@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "decrease_taobao@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_meituan.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "increase_meituan@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "increase_meituan@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_taobao.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "increase_taobao@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "increase_taobao@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/decrease_baiduwaimai.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "decrease_baiduwaimai@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "decrease_baiduwaimai@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/increase_baiduwaimai.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "increase_baiduwaimai@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "increase_baiduwaimai@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/PPNumberButton/View/PPTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // PPTableViewCell.h
3 | // PPNumberButton
4 | //
5 | // Created by YiAi on 2017/7/5.
6 | // Copyright © 2017年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class PPTableViewModel;
12 | @interface PPTableViewCell : UITableViewCell
13 |
14 | @property (nonatomic, strong) PPTableViewModel *model;
15 | @property (nonatomic, copy) void(^resultBlock)(NSInteger number);
16 | @end
17 |
18 |
19 | @interface PPTableViewModel : NSObject
20 | @property (nonatomic, copy) NSString *title;
21 | @property (nonatomic, assign) NSInteger number;
22 | @end
23 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/duoyi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/PPNumberButton.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'PPNumberButton'
3 | s.version = '0.7.0'
4 | s.license = { :type => "MIT", :file => "LICENSE" }
5 | s.homepage = 'https://github.com/jkpang/PPNumberButton.git'
6 | s.authors = { "jkpang" => "jkpang@outlook.com" }
7 | s.summary = 'iOS中一款高度可定制性商品计数按钮(京东/淘宝/饿了么/美团外卖/百度外卖样式),使用简单!'
8 |
9 | s.platform = :ios, '7.0'
10 | s.source = { git: 'https://github.com/jkpang/PPNumberButton.git', :tag => s.version.to_s}
11 | s.source_files = 'PPNumberButton/PPNumberButton/*.{h,m}'
12 | s.frameworks = 'UIKit'
13 | s.requires_arc = true
14 |
15 | end
16 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/AndyPang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PPNumberButton.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 2281A7641D7669C90094E113
16 |
17 | primary
18 |
19 |
20 | 2281A77D1D7669CA0094E113
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/YiAi.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PPNumberButton.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 2281A7641D7669C90094E113
16 |
17 | primary
18 |
19 |
20 | 2281A77D1D7669CA0094E113
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/duoyi.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PPNumberButton.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 2281A7641D7669C90094E113
16 |
17 | primary
18 |
19 |
20 | 2281A77D1D7669CA0094E113
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/PPNumberButtonTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 |
--------------------------------------------------------------------------------
/PPNumberButtonTests/PPNumberButtonTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PPNumberButtonTests.m
3 | // PPNumberButtonTests
4 | //
5 | // Created by AndyPang on 16/8/31.
6 | // Copyright © 2016年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PPNumberButtonTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PPNumberButtonTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 jkpang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/PPNumberButton/View/PPTableViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xccheckout
23 | *.xcscmblueprint
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 | *.dSYM.zip
29 | *.dSYM
30 |
31 | # CocoaPods
32 | #
33 | # We recommend against adding the Pods directory to your .gitignore. However
34 | # you should judge for yourself, the pros and cons are mentioned at:
35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
36 | #
37 | # Pods/
38 |
39 | # Carthage
40 | #
41 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
42 | # Carthage/Checkouts
43 |
44 | Carthage/Build
45 |
46 | # fastlane
47 | #
48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
49 | # screenshots whenever they are needed.
50 | # For more information about the recommended setup visit:
51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
52 |
53 | fastlane/report.xml
54 | fastlane/Preview.html
55 | fastlane/screenshots
56 | fastlane/test_output
57 |
58 | # Code Injection
59 | #
60 | # After new code Injection tools there's a generated folder /iOSInjectionProject
61 | # https://github.com/johnno1962/injectionforxcode
62 |
63 | iOSInjectionProject/
64 |
--------------------------------------------------------------------------------
/PPNumberButton/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PPNumberButton/View/PPTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // PPTableViewCell.m
3 | // PPNumberButton
4 | //
5 | // Created by YiAi on 2017/7/5.
6 | // Copyright © 2017年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import "PPTableViewCell.h"
10 | #import "PPNumberButton.h"
11 |
12 | @interface PPTableViewCell ()
13 |
14 | @property (nonatomic, strong) PPNumberButton *numberButton;
15 |
16 | @end
17 |
18 | @implementation PPTableViewCell
19 |
20 | - (void)awakeFromNib {
21 | [super awakeFromNib];
22 |
23 | [self.contentView addSubview:self.numberButton];
24 | }
25 |
26 | - (void)setModel:(PPTableViewModel *)model
27 | {
28 | _model = model;
29 | self.numberButton.currentNumber = model.number;
30 | }
31 |
32 | #pragma mark - PPNumberButtonDelegate
33 | - (void)pp_numberButton:(PPNumberButton *)numberButton number:(NSInteger)number increaseStatus:(BOOL)increaseStatus
34 | {
35 | _model.number = number;
36 | }
37 |
38 | #pragma mark - lazy
39 | - (PPNumberButton *)numberButton
40 | {
41 | if (!_numberButton) {
42 | _numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 110 - 20, 15, 110, 30)];
43 | _numberButton.delegate = self;
44 | // 初始化时隐藏减按钮
45 | _numberButton.decreaseHide = YES;
46 | _numberButton.increaseImage = [UIImage imageNamed:@"increase_meituan"];
47 | _numberButton.decreaseImage = [UIImage imageNamed:@"decrease_meituan"];
48 |
49 | _numberButton.resultBlock = ^(PPNumberButton *ppBtn, CGFloat number, BOOL increaseStatus) {
50 | NSLog(@"%ld",number);
51 | };
52 | }
53 | return _numberButton;
54 | }
55 |
56 | @end
57 |
58 | @implementation PPTableViewModel
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/PPNumberButton/Controller/PPViewController2.m:
--------------------------------------------------------------------------------
1 | //
2 | // PPViewController2.m
3 | // PPNumberButton
4 | //
5 | // Created by YiAi on 2017/7/5.
6 | // Copyright © 2017年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import "PPViewController2.h"
10 | #import "PPTableViewCell.h"
11 |
12 | @interface PPViewController2 ()
13 |
14 | @property (nonatomic, strong) NSMutableArray *dataSource;
15 |
16 | @end
17 |
18 | @implementation PPViewController2
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 |
23 | self.tableView.rowHeight = 60;
24 | self.tableView.tableFooterView = [UIView new];
25 | [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([PPTableViewCell class]) bundle:nil] forCellReuseIdentifier:NSStringFromClass([PPTableViewCell class])];
26 | }
27 |
28 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
29 | {
30 | return self.dataSource.count;
31 | }
32 |
33 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
34 | {
35 | PPTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([PPTableViewCell class])];
36 |
37 | cell.model = self.dataSource[indexPath.row];
38 |
39 | cell.textLabel.text = [NSString stringWithFormat:@"第%ld个按钮",indexPath.row+1];
40 |
41 | return cell;
42 | }
43 |
44 | #pragma mark - lazy
45 | - (NSMutableArray *)dataSource
46 | {
47 | if (!_dataSource) {
48 | _dataSource = [[NSMutableArray alloc] init];
49 |
50 | for (NSInteger i = 0; i < 20; i++) {
51 | PPTableViewModel *model = [PPTableViewModel new];
52 | model.number = 0;
53 | [_dataSource addObject:model];
54 | }
55 | }
56 | return _dataSource;
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/PPNumberButton/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | }
88 | ],
89 | "info" : {
90 | "version" : 1,
91 | "author" : "xcode"
92 | }
93 | }
--------------------------------------------------------------------------------
/PPNumberButton/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/PPNumberButton/Controller/PPHomePageController.m:
--------------------------------------------------------------------------------
1 | //
2 | // PPHomePageController.m
3 | // PPNumberButton
4 | //
5 | // Created by YiAi on 2017/7/5.
6 | // Copyright © 2017年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import "PPHomePageController.h"
10 | #import "PPViewController1.h"
11 | #import "PPViewController2.h"
12 |
13 | @interface PPHomePageController ()
14 |
15 | @end
16 |
17 | @implementation PPHomePageController
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 | self.tableView.rowHeight = 66;
22 | }
23 |
24 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
25 | {
26 | return 3;
27 | }
28 |
29 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
30 | {
31 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
32 | if (!cell) {
33 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
34 | }
35 | cell.detailTextLabel.numberOfLines = 0;
36 | if (indexPath.row == 0) {
37 | cell.textLabel.text = @"PPViewController1";
38 | cell.detailTextLabel.text = @"普通view形式";
39 | }else if (indexPath.row == 1) {
40 | cell.textLabel.text = @"PPViewController2";
41 | cell.detailTextLabel.text = @"列表形式 - table style";
42 | }else if (indexPath.row == 2) {
43 | cell.textLabel.text = @"PPViewController3";
44 | cell.detailTextLabel.text = @"新增动态改变步长stepValue、动态改变最大值maxValue、动态改变是否支持小数等功能展示";
45 | }
46 | return cell;
47 | }
48 |
49 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
50 | {
51 | UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
52 | UIViewController *controller = [storyBoard instantiateViewControllerWithIdentifier:[NSString stringWithFormat:@"PPViewController%ld",indexPath.row+1]];
53 | [self.navigationController pushViewController:controller animated:YES];
54 | }
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/PPNumberButton/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PPNumberButton
4 | //
5 | // Created by AndyPang on 16/8/31.
6 | // Copyright © 2016年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 | - (void)applicationWillResignActive:(UIApplication *)application {
24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26 | }
27 |
28 | - (void)applicationDidEnterBackground:(UIApplication *)application {
29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31 | }
32 |
33 | - (void)applicationWillEnterForeground:(UIApplication *)application {
34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
35 | }
36 |
37 | - (void)applicationDidBecomeActive:(UIApplication *)application {
38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application {
42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/PPNumberButton/Controller/PPViewController1.m:
--------------------------------------------------------------------------------
1 | //
2 | // PPViewController1.m
3 | // PPNumberButton
4 | //
5 | // Created by YiAi on 2017/7/5.
6 | // Copyright © 2017年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import "PPViewController1.h"
10 | #import "PPNumberButton.h"
11 |
12 | @interface PPViewController1 ()
13 |
14 | @end
15 |
16 | @implementation PPViewController1
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | [self example1];
22 | [self example2];
23 | [self example3];
24 | [self example4];
25 | }
26 |
27 | /**
28 | 自定义加减按钮文字标题
29 | */
30 | - (void)example1
31 | {
32 | PPNumberButton *numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 100, 110, 30)];
33 | // 开启抖动动画
34 | numberButton.shakeAnimation = YES;
35 | // 设置最小值
36 | numberButton.minValue = 2;
37 | // 设置最大值
38 | numberButton.maxValue = 10;
39 | // 设置输入框中的字体大小
40 | numberButton.inputFieldFont = 23;
41 | numberButton.increaseTitle = @"+";
42 | numberButton.decreaseTitle = @"-";
43 | numberButton.currentNumber = 777;
44 | numberButton.delegate = self;
45 | numberButton.longPressSpaceTime = CGFLOAT_MAX;
46 |
47 | numberButton.resultBlock = ^(PPNumberButton *ppBtn, CGFloat number, BOOL increaseStatus){
48 | NSLog(@"%f",number);
49 | };
50 | [self.view addSubview:numberButton];
51 | }
52 |
53 | - (void)pp_numberButton:(__kindof UIView *)numberButton number:(NSInteger)number increaseStatus:(BOOL)increaseStatus
54 | {
55 | NSLog(@"%@",increaseStatus ? @"加运算":@"减运算");
56 | }
57 |
58 | /**
59 | 边框状态
60 | */
61 | - (void)example2
62 | {
63 | PPNumberButton *numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 160, 150, 30)];
64 | //设置边框颜色
65 | numberButton.borderColor = [UIColor grayColor];
66 | numberButton.increaseTitle = @"+";
67 | numberButton.decreaseTitle = @"-";
68 | numberButton.currentNumber = 777;
69 | numberButton.resultBlock = ^(PPNumberButton *ppBtn, CGFloat number, BOOL increaseStatus){
70 | NSLog(@"%f",number);
71 | };
72 |
73 | [self.view addSubview:numberButton];
74 | }
75 |
76 |
77 | /**
78 | 自定义加减按钮背景图片
79 | */
80 | - (void)example3
81 | {
82 | PPNumberButton *numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 220, 100, 30)];
83 | numberButton.shakeAnimation = YES;
84 | numberButton.increaseImage = [UIImage imageNamed:@"increase_taobao"];
85 | numberButton.decreaseImage = [UIImage imageNamed:@"decrease_taobao"];
86 |
87 | numberButton.resultBlock = ^(PPNumberButton *ppBtn, CGFloat number, BOOL increaseStatus){
88 | NSLog(@"%f",number);
89 | };
90 |
91 | [self.view addSubview:numberButton];
92 | }
93 |
94 | /**
95 | 饿了么,美团外卖,百度外卖样式
96 | */
97 | - (void)example4
98 | {
99 | PPNumberButton *numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 280, 100, 30)];
100 | // 初始化时隐藏减按钮
101 | numberButton.decreaseHide = YES;
102 | numberButton.increaseImage = [UIImage imageNamed:@"increase_meituan"];
103 | numberButton.decreaseImage = [UIImage imageNamed:@"decrease_meituan"];
104 | numberButton.currentNumber = -777;
105 | numberButton.resultBlock = ^(PPNumberButton *ppBtn, CGFloat number, BOOL increaseStatus){
106 | NSLog(@"%f",number);
107 | };
108 |
109 | [self.view addSubview:numberButton];
110 | }
111 |
112 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
113 | {
114 | [self.view endEditing:YES];
115 | }
116 |
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/PPNumberButton/PPNumberButton/PPNumberButton.h:
--------------------------------------------------------------------------------
1 | //
2 | // PPNumberButton.h
3 | // PPNumberButton
4 | //
5 | // Created by AndyPang on 16/8/31.
6 | // Copyright © 2016年 AndyPang. All rights reserved.
7 | //
8 |
9 | /*
10 | *********************************************************************************
11 | *
12 | *⭐️⭐️⭐️ 新建 PP-iOS学习交流群: 323408051 欢迎加入!!! ⭐️⭐️⭐️
13 | *
14 | * 如果您在使用 PPNumberButton 的过程中出现bug或有更好的建议,还请及时以下列方式联系我,我会及
15 | * 时修复bug,解决问题.
16 | *
17 | * Weibo : jkpang-庞
18 | * Email : jkpang@outlook.com
19 | * QQ 群 : 323408051
20 | * GitHub: https://github.com/jkpang
21 | *
22 | * PS:我的另外两个很好用的封装,欢迎使用!
23 | * 1.对AFNetworking 3.x 与YYCache的二次封装,一句代码搞定数据请求与缓存,告别FMDB:
24 | * GitHub:https://github.com/jkpang/PPNetworkHelper
25 | * 2.一行代码获取通讯录联系人,并进行A~Z精准排序(已处理姓名所有字符的排序问题):
26 | * GitHub:https://github.com/jkpang/PPGetAddressBook
27 | *
28 | * 如果 PPNumberButton 好用,希望您能Star支持,你的 ⭐️ 是我持续更新的动力!
29 | *********************************************************************************
30 | */
31 |
32 | #import
33 |
34 | @class PPNumberButton;
35 | @protocol PPNumberButtonDelegate
36 | @optional
37 |
38 | /**
39 | 加减代理回调
40 |
41 | @param numberButton 按钮
42 | @param number 结果
43 | @param increaseStatus 是否为加状态
44 | */
45 | - (void)pp_numberButton:(PPNumberButton *)numberButton number:(NSInteger)number increaseStatus:(BOOL)increaseStatus;
46 |
47 | @end
48 |
49 |
50 | IB_DESIGNABLE
51 | @interface PPNumberButton : UIView
52 |
53 | - (instancetype)initWithFrame:(CGRect)frame;
54 | + (instancetype)numberButtonWithFrame:(CGRect)frame;
55 |
56 | /** 加减按钮的Block回调*/
57 | @property (nonatomic, copy) void(^resultBlock)(PPNumberButton *ppBtn,CGFloat number, BOOL increaseStatus/* 是否为加状态*/);
58 | /** 代理*/
59 | @property (nonatomic, weak) id delegate;
60 |
61 | #pragma mark - 自定义样式属性设置
62 | /** 是否开启抖动动画, default is NO*/
63 | @property (nonatomic, assign ) IBInspectable BOOL shakeAnimation;
64 | /** 为YES时,初始化时减号按钮隐藏(饿了么/百度外卖/美团外卖按钮模式),default is NO*/
65 | @property (nonatomic, assign ) IBInspectable BOOL decreaseHide;
66 | /** 是否可以使用键盘输入,default is YES*/
67 | @property (nonatomic, assign, getter=isEditing) IBInspectable BOOL editing;
68 |
69 | /** 设置边框的颜色,如果没有设置颜色,就没有边框 */
70 | @property (nonatomic, strong ) IBInspectable UIColor *borderColor;
71 |
72 | /** 输入框中的内容 */
73 | @property (nonatomic, assign ) CGFloat currentNumber;
74 | /** 递增步长,默认步长为1 */
75 | @property (nonatomic, assign ) CGFloat stepValue;
76 |
77 | /** 输入框中的字体大小 */
78 | @property (nonatomic, assign ) IBInspectable CGFloat inputFieldFont;
79 |
80 | /** 长按加减的时间间隔,默认0.1s,设置为 CGFLOAT_MAX 则关闭长按加减功能*/
81 | @property (nonatomic, assign ) IBInspectable CGFloat longPressSpaceTime;
82 |
83 | /** 加减按钮的字体大小 */
84 | @property (nonatomic, assign ) IBInspectable CGFloat buttonTitleFont;
85 | /** 加按钮背景图片 */
86 | @property (nonatomic, strong ) IBInspectable UIImage *increaseImage;
87 | /** 减按钮背景图片 */
88 | @property (nonatomic, strong ) IBInspectable UIImage *decreaseImage;
89 | /** 加按钮标题 */
90 | @property (nonatomic, copy ) IBInspectable NSString *increaseTitle;
91 | /** 减按钮标题 */
92 | @property (nonatomic, copy ) IBInspectable NSString *decreaseTitle;
93 |
94 | /** 最小值, default is 0 */
95 | @property (nonatomic, assign ) IBInspectable CGFloat minValue;
96 | /** 最大值 */
97 | @property (nonatomic, assign ) CGFloat maxValue;
98 | /** 目前支持一位小数的递增 */
99 | @property (nonatomic, assign ) BOOL decimalNum;
100 |
101 | @end
102 |
103 | #pragma mark - NSString分类
104 | @interface NSString (PPNumberButton)
105 | /**
106 | 字符串 nil, @"", @" ", @"\n" Returns NO;
107 | 其他 Returns YES.
108 | */
109 | - (BOOL)pp_isNotBlank;
110 | @end
111 |
112 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/YiAi.xcuserdatad/xcschemes/PPNumberButton.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
83 |
85 |
91 |
92 |
93 |
94 |
96 |
97 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/duoyi.xcuserdatad/xcschemes/PPNumberButton.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
83 |
85 |
91 |
92 |
93 |
94 |
96 |
97 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/xcuserdata/AndyPang.xcuserdatad/xcschemes/PPNumberButton.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
83 |
85 |
91 |
92 |
93 |
94 |
96 |
97 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/PPNumberButton/Controller/PPViewController3.m:
--------------------------------------------------------------------------------
1 | //
2 | // PPViewController3.m
3 | // PPNumberButton
4 | //
5 | // Created by zhengwenming on 2018/2/8.
6 | // Copyright © 2018年 AndyPang. All rights reserved.
7 | //
8 |
9 | #import "PPViewController3.h"
10 | #import "PPNumberButton.h"
11 |
12 | @interface PPViewController3 ()
13 | @property(nonatomic,strong)PPNumberButton *numberButton;
14 | @property(nonatomic,strong)UITextField *maxValueTF;
15 | @property(nonatomic,strong)UITextField *stepValueTF;
16 |
17 | @end
18 |
19 | @implementation PPViewController3
20 | -(void)initUI{
21 | UILabel *maxValueLabel = [UILabel new];
22 | maxValueLabel.text = @"设置最大值:";
23 | maxValueLabel.textColor = [UIColor greenColor];
24 | maxValueLabel.font = [UIFont systemFontOfSize:15.0];
25 | [maxValueLabel sizeToFit];
26 |
27 |
28 | UILabel *stepValueLabel = [UILabel new];
29 | stepValueLabel.text = @"设置步长值:";
30 | stepValueLabel.textColor = [UIColor greenColor];
31 | stepValueLabel.font = [UIFont systemFontOfSize:15.0];
32 | [stepValueLabel sizeToFit];
33 |
34 | self.maxValueTF = [[UITextField alloc] initWithFrame:CGRectMake(30, 100, maxValueLabel.frame.size.width+50, 30)];
35 | self.maxValueTF.delegate = self;
36 | self.maxValueTF.backgroundColor = [UIColor lightGrayColor];
37 | self.maxValueTF.textAlignment = NSTextAlignmentCenter;
38 | self.maxValueTF.keyboardType = UIKeyboardTypeDecimalPad;
39 | self.maxValueTF.leftViewMode = UITextFieldViewModeAlways;
40 | [self.view addSubview:self.maxValueTF];
41 | self.maxValueTF.leftView = maxValueLabel;
42 |
43 | self.stepValueTF = [[UITextField alloc] initWithFrame:CGRectMake(30, CGRectGetMaxY(self.maxValueTF.frame)+30, stepValueLabel.frame.size.width+50, 30)];
44 | self.stepValueTF.delegate = self;
45 | self.stepValueTF.backgroundColor = [UIColor lightGrayColor];
46 | self.stepValueTF.textAlignment = NSTextAlignmentCenter;
47 | self.stepValueTF.keyboardType = UIKeyboardTypeDecimalPad;
48 | self.stepValueTF.leftViewMode = UITextFieldViewModeAlways;
49 | [self.view addSubview:self.stepValueTF];
50 | self.stepValueTF.leftView = stepValueLabel;
51 |
52 | UILabel *decimalNumLabel = [UILabel new];
53 | decimalNumLabel.text = @"小数功能开关:";
54 | decimalNumLabel.textColor = [UIColor greenColor];
55 | decimalNumLabel.font = [UIFont systemFontOfSize:15.0];
56 | [decimalNumLabel sizeToFit];
57 | decimalNumLabel.frame = CGRectMake(self.stepValueTF.frame.origin.x, CGRectGetMaxY(self.stepValueTF.frame)+30, decimalNumLabel.frame.size.width, 30);
58 | [self.view addSubview:decimalNumLabel];
59 |
60 |
61 | UISwitch *decimalNumSwitch = [UISwitch new];
62 | decimalNumSwitch.frame = CGRectMake(CGRectGetMaxX(decimalNumLabel.frame), decimalNumLabel.frame.origin.y, 100, 30);
63 | [decimalNumSwitch addTarget:self action:@selector(valueChangeAction:) forControlEvents:UIControlEventValueChanged];
64 | [self.view addSubview:decimalNumSwitch];
65 | }
66 | - (void)viewDidLoad {
67 | [super viewDidLoad];
68 | [self initUI];
69 |
70 | self.numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 220, 120, 30)];
71 | self.numberButton.shakeAnimation = YES;
72 | self.numberButton.backgroundColor = [UIColor lightGrayColor];
73 | self.numberButton.increaseImage = [UIImage imageNamed:@"increase_taobao"];
74 | self.numberButton.decreaseImage = [UIImage imageNamed:@"decrease_taobao"];
75 | __weak __typeof(&*self) weakSelf = self;
76 | self.numberButton.resultBlock = ^(PPNumberButton *ppBtn, CGFloat number, BOOL increaseStatus){
77 | [weakSelf.view endEditing:YES];
78 | NSLog(@"%f",number);
79 | };
80 | [self.view addSubview:self.numberButton];
81 | self.numberButton.center = self.view.center;
82 | }
83 | -(void)valueChangeAction:(UISwitch *)decimalNumSwitch{
84 | self.numberButton.decimalNum = decimalNumSwitch.isOn;
85 | }
86 | -(void)textFieldDidEndEditing:(UITextField *)textField{
87 | if (textField==self.stepValueTF) {
88 | self.numberButton.stepValue = textField.text.floatValue;
89 | }else if (textField==self.maxValueTF){
90 | self.numberButton.maxValue = textField.text.floatValue;
91 | }
92 | }
93 | -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
94 | [super touchesBegan:touches withEvent:event];
95 | [self.view endEditing:YES];
96 | }
97 | @end
98 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 |      [](http://weibo.com/5743737098/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1)
4 |
5 | ### iOS中一款高度可定制性商品计数按钮,使用简单!
6 |
7 | * 支持自定义加/减按钮的标题内容、背景图片;
8 | * 支持设置边框颜色;
9 | * 支持使用键盘输入;
10 | * 支持长按加/减按钮快速加减;
11 | * 支持block回调与delegate(代理)回调;
12 | * 支持使用xib创建、直接在IB面板设置相关属性;
13 | * 支持设置maxValue(最大值)与minValue(最小值).
14 | * 支持按钮自定义为京东/淘宝样式,饿了么/美团外卖/百度外卖样式;
15 |
16 | ### 新建 PP-iOS学习交流群 : 323408051 有关于PP系列封装的问题和iOS技术可以在此群讨论
17 | [简书地址](http://www.jianshu.com/p/0b6f53a1ccaf) ;
18 |
19 | #### 如果你需要Swift版本,请戳: https://github.com/jkpang/PPNumberButtonSwift
20 |
21 |  
22 |
23 | ## Requirements 要求
24 | * iOS 7+
25 | * Xcode 8+
26 |
27 | ## Installation 安装
28 | ### 1.手动安装:
29 | 下载DEMO后,将子文件夹PPNumberButton拖入到项目中, 导入头文件PPNumberButton.h开始使用.
30 | ### 2.CocoaPods安装:
31 | first
32 | `pod 'PPNumberButton'
33 | then
34 | `pod install或pod install --no-repo-update`
35 |
36 | 如果发现pod search PPNumberButton 不是最新版本,在终端执行pod setup命令更新本地spec镜像缓存(时间可能有点长),重新搜索就OK了
37 | ## Usage 使用方法
38 | #### 实例化方法
39 | `[[PPNumberButton alloc] init];`:默认的frame为CGRectMake(0, 0, 110, 30)
40 | 或
41 | `[[PPNumberButton alloc] initWithFrame:frame];`
42 |
43 | 或
44 | `[PPNumberButton numberButtonWithFrame:frame];`: 类方法创建
45 | ### 1.自定义加减按钮文字标题
46 |
47 | ```objc
48 | PPNumberButton *numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 100, 110, 30)];
49 | // 开启抖动动画
50 | numberButton.shakeAnimation = YES;
51 | // 设置最小值
52 | numberButton.minValue = 2;
53 | // 设置最大值
54 | numberButton.maxValue = 10;
55 | // 设置输入框中的字体大小
56 | numberButton.inputFieldFont = 23;
57 | numberButton.increaseTitle = @"+";
58 | numberButton.decreaseTitle = @"-";
59 |
60 | numberButton.resultBlock = ^(NSString *num){
61 | NSLog(@"%@",num);
62 | };
63 | [self.view addSubview:numberButton];
64 | ```
65 | ### 2.边框状态
66 |
67 | ```objc
68 | PPNumberButton *numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 160, 150, 30)];
69 | //设置边框颜色
70 | numberButton.borderColor = [UIColor grayColor];
71 | numberButton.increaseTitle = @"+";
72 | numberButton.decreaseTitle = @"-";
73 | numberButton.resultBlock = ^(NSString *num){
74 | NSLog(@"%@",num);
75 | };
76 | [self.view addSubview:numberButton];
77 |
78 | ```
79 | ### 3.自定义加减按钮背景图片
80 |
81 | ```objc
82 | PPNumberButton *numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 220, 100, 30)];
83 | numberButton.shakeAnimation = YES;
84 | numberButton.increaseImage = [UIImage imageNamed:@"increase_taobao"];
85 | numberButton.decreaseImage = [UIImage imageNamed:@"decrease_taobao"];
86 | numberButton.resultBlock = ^(NSString *num){
87 | NSLog(@"%@",num);
88 | };
89 | [self.view addSubview:numberButton];
90 | ```
91 | ### 4.饿了么,美团外卖,百度外卖样式
92 |
93 | ```objc
94 | PPNumberButton *numberButton = [PPNumberButton numberButtonWithFrame:CGRectMake(100, 280, 100, 30)];
95 | // 初始化时隐藏减按钮
96 | numberButton.decreaseHide = YES;
97 | numberButton.increaseImage = [UIImage imageNamed:@"increase_meituan"];
98 | numberButton.decreaseImage = [UIImage imageNamed:@"decrease_meituan"];
99 | numberButton.resultBlock = ^(NSString *num){
100 | NSLog(@"%@",num);
101 | };
102 | [self.view addSubview:numberButton];
103 | ```
104 |
105 | **更多详细用法参见Demo**
106 |
107 | ## 使用xib创建
108 | 在控制器界面拖入UIView控件,在右侧的设置栏中将class名修改为PPNumberButton,按回车就OK了 **(注意:如果通过Cocopods导入, 使用XIB/SB创建按钮会显示不全,还可能会报错.但APP可以编译运行,这应该是Cocopods或Xcode的问题)**.
109 | 
110 | _*注意!如果有的同学将控件拖线到代码中,千万不要忘记在拖线的代码文件中导入 "PPNumberButton.h"头文件,否则会报错.*_
111 |
112 | **可以在IB界面设置相关属性**
113 | 
114 |
115 | 因为之前的项目中需要,在网上找了好多都不符合要求,干脆自己花了点时间撸了一个,现在分享出来,希望能帮到有需要的人。 如果你觉得不错,希望点个Star鼓励一下!
116 | #### 你的Star是我持续更新的动力!
117 |
118 | ## CocoaPods更新日志
119 |
120 | ```
121 | • 2017.07.05(tag:0.7.0):
122 | 1.新增 longPressSpaceTime 属性,设置长按加减速度的快慢以及功能关闭;
123 | 2.新增tableView列表Demo;
124 | 3.其他代码小细节优化.
125 |
126 | • 2016.12.22(tag:0.6.0):
127 | 1.将代理与Block回调的结果数字的类型 由 NSString -> NSInteger;
128 | 2.代理与Block回调结果增加 increaseStatus(加运算状态);
129 | 3.修复有时代理方法没有被实现导致Crash的Bug;
130 | 4.修复减按钮为隐藏模式时,减运算到最小值没有回调的BUG.
131 |
132 | • 2016.12.19(tag:0.5.0):
133 | 新增 editing(是否可以使用键盘输入)属性.
134 |
135 | • 2016.12.09(tag:0.4.0):
136 | 1.修复当”减”按钮初始化为隐藏模式时, 对其赋值不了的BUG;
137 | 2.优化代码,修复其他小问题.
138 |
139 | • 2016.11.03(tag:0.3.0)--重大更新:
140 | 1.增加饿了么/美团外卖/百度外卖样式;
141 | 2.调整自定义属性设置接口.
142 |
143 | • 2016.11.03(tag:0.2.0):
144 | 设置maxValue(最大值)与minValue(最小值)属性接口.
145 |
146 | • 2016.09.14(tag:0.1.2);
147 | 添加使用XIB创建时的实时显示
148 |
149 | • 2016.09.12(tag:0.1.1):
150 | 小细节优化.
151 |
152 | • 2016.09.03(tag:0.1.0):
153 | Pods初始化.
154 | ```
155 |
156 | ## 联系方式:
157 | * Weibo : [@jkpang-庞](http://weibo.com/5743737098/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1)
158 | * Email : jkpang@outlook.com
159 | * QQ群 : 323408051
160 | * Blog : https://www.jkpang.cn
161 |
162 | 
163 |
164 | ## 许可证
165 | PPNumberButton 使用 MIT 许可证,详情见 LICENSE 文件。
166 |
167 |
168 |
--------------------------------------------------------------------------------
/PPNumberButton/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
--------------------------------------------------------------------------------
/PPNumberButton/PPNumberButton/PPNumberButton.m:
--------------------------------------------------------------------------------
1 | //
2 | // PPNumberButton.m
3 | // PPNumberButton
4 | //
5 | // Created by AndyPang on 16/8/31.
6 | // Copyright © 2016年 AndyPang. All rights reserved.
7 | //
8 |
9 | /*
10 | *********************************************************************************
11 | *
12 | *⭐️⭐️⭐️ 新建 PP-iOS学习交流群: 323408051 欢迎加入!!! ⭐️⭐️⭐️
13 | *
14 | * 如果您在使用 PPNumberButton 的过程中出现bug或有更好的建议,还请及时以下列方式联系我,我会及
15 | * 时修复bug,解决问题.
16 | *
17 | * Weibo : jkpang-庞
18 | * Email : jkpang@outlook.com
19 | * QQ 群 : 323408051
20 | * GitHub: https://github.com/jkpang
21 | *
22 | * PS:我的另外两个很好用的封装,欢迎使用!
23 | * 1.对AFNetworking 3.x 与YYCache的二次封装,一句代码搞定数据请求与缓存,告别FMDB:
24 | * GitHub:https://github.com/jkpang/PPNetworkHelper
25 | * 2.一行代码获取通讯录联系人,并进行A~Z精准排序(已处理姓名所有字符的排序问题):
26 | * GitHub:https://github.com/jkpang/PPGetAddressBook
27 | *
28 | * 如果 PPNumberButton 好用,希望您能Star支持,你的 ⭐️ 是我持续更新的动力!
29 | *********************************************************************************
30 | */
31 |
32 |
33 | #import "PPNumberButton.h"
34 |
35 | #ifdef DEBUG
36 | #define PPLog(...) printf("[%s] %s [第%d行]: %s\n", __TIME__ ,__PRETTY_FUNCTION__ ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String])
37 | #else
38 | #define PPLog(...)
39 | #endif
40 |
41 |
42 | @interface PPNumberButton ()
43 | {
44 | CGFloat _width; // 控件自身的宽
45 | CGFloat _height; // 控件自身的高
46 | }
47 | /** 快速加减定时器*/
48 | @property (nonatomic, strong) NSTimer *timer;
49 | /** 减按钮*/
50 | @property (nonatomic, strong) UIButton *decreaseBtn;
51 | /** 加按钮*/
52 | @property (nonatomic, strong) UIButton *increaseBtn;
53 | /** 数量展示/输入框*/
54 | @property (nonatomic, strong) UITextField *textField;
55 |
56 | @end
57 |
58 |
59 | @implementation PPNumberButton
60 |
61 | #pragma mark - 初始化
62 | - (instancetype)initWithFrame:(CGRect)frame
63 | {
64 | if (self = [super initWithFrame:frame]) {
65 | [self setupUI];
66 | //整个控件的默认尺寸(和某宝上面的按钮同样大小)
67 | if(CGRectIsEmpty(frame)) {self.frame = CGRectMake(0, 0, 110, 30);};
68 | }
69 | return self;
70 | }
71 |
72 | - (instancetype)initWithCoder:(NSCoder *)coder
73 | {
74 | if (self = [super initWithCoder:coder]) {
75 | [self setupUI];
76 | }
77 | return self;
78 | }
79 |
80 | + (instancetype)numberButtonWithFrame:(CGRect)frame
81 | {
82 | return [[PPNumberButton alloc] initWithFrame:frame];
83 | }
84 |
85 | #pragma mark - 设置UI子控件
86 | - (void)setupUI
87 | {
88 | self.stepValue = 1;
89 | _minValue = 0;
90 | _maxValue = NSIntegerMax;
91 | _inputFieldFont = 15;
92 | _buttonTitleFont = 17;
93 | _longPressSpaceTime = 0.1f;
94 |
95 | //加,减按钮
96 | _increaseBtn = [self creatButton];
97 | _decreaseBtn = [self creatButton];
98 |
99 | //数量展示/输入框
100 | _textField = [[UITextField alloc] init];
101 | _textField.delegate = self;
102 | _textField.textAlignment = NSTextAlignmentCenter;
103 | _textField.keyboardType = UIKeyboardTypeDecimalPad;
104 | _textField.font = [UIFont systemFontOfSize:_inputFieldFont];
105 | if (self.decimalNum) {
106 | _textField.text = [NSString stringWithFormat:@"%.1f",_minValue];
107 | }else{
108 | _textField.text = [NSString stringWithFormat:@"%.f",_minValue];
109 | }
110 |
111 | [self addSubview:_decreaseBtn];
112 | [self addSubview:_increaseBtn];
113 | [self addSubview:_textField];
114 |
115 | self.clipsToBounds = YES;
116 | self.layer.cornerRadius = 3.f;
117 | self.backgroundColor = [UIColor whiteColor];
118 | }
119 |
120 | //设置加减按钮的公共方法
121 | - (UIButton *)creatButton
122 | {
123 | UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
124 | button.titleLabel.font = [UIFont boldSystemFontOfSize:_buttonTitleFont];
125 | [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
126 | [button addTarget:self action:@selector(touchDown:) forControlEvents:UIControlEventTouchDown];
127 | [button addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpOutside|UIControlEventTouchUpInside|UIControlEventTouchCancel];
128 | return button;
129 | }
130 |
131 | #pragma mark - layoutSubviews
132 | - (void)layoutSubviews
133 | {
134 | [super layoutSubviews];
135 |
136 | _width = self.frame.size.width;
137 | _height = self.frame.size.height;
138 | _textField.frame = CGRectMake(_height, 0, _width - 2*_height, _height);
139 | _increaseBtn.frame = CGRectMake(_width - _height, 0, _height, _height);
140 |
141 | if (_decreaseHide && _textField.text.floatValue < _minValue) {
142 | _decreaseBtn.frame = CGRectMake(_width-_height, 0, _height, _height);
143 | } else {
144 | _decreaseBtn.frame = CGRectMake(0, 0, _height, _height);
145 | }
146 | }
147 |
148 | #pragma mark - UITextFieldDelegate
149 | - (void)textFieldDidEndEditing:(UITextField *)textField
150 | {
151 | [self checkTextFieldNumberWithUpdate];
152 | [self buttonClickCallBackWithIncreaseStatus:NO];
153 | }
154 |
155 | #pragma mark - 加减按钮点击响应
156 | /// 点击: 单击逐次加减,长按连续快速加减
157 | - (void)touchDown:(UIButton *)sender
158 | {
159 | [_textField resignFirstResponder];
160 |
161 | if (sender == _increaseBtn) {
162 | _timer = [NSTimer scheduledTimerWithTimeInterval:_longPressSpaceTime target:self selector:@selector(increase) userInfo:nil repeats:YES];
163 | } else {
164 | _timer = [NSTimer scheduledTimerWithTimeInterval:_longPressSpaceTime target:self selector:@selector(decrease) userInfo:nil repeats:YES];
165 | }
166 | [_timer fire];
167 | }
168 |
169 | /// 手指松开
170 | - (void)touchUp:(UIButton *)sender { [self cleanTimer]; }
171 |
172 | /// 加运算
173 | - (void)increase
174 | {
175 | [self checkTextFieldNumberWithUpdate];
176 |
177 | CGFloat number = [_textField.text floatValue] + self.stepValue;
178 |
179 | if (number <= _maxValue) {
180 | // 当按钮为"减号按钮隐藏模式",且输入框值==设定最小值,减号按钮展开
181 | if (_decreaseHide && number==_minValue) {
182 | [self rotationAnimationMethod];
183 | [UIView animateWithDuration:0.3f animations:^{
184 | _decreaseBtn.alpha = 1;
185 | _decreaseBtn.frame = CGRectMake(0, 0, _height, _height);
186 | } completion:^(BOOL finished) {
187 | _textField.hidden = NO;
188 | }];
189 | }
190 |
191 | if (self.decimalNum) {
192 | _textField.text = [NSString stringWithFormat:@"%.1f",number];
193 | }else{
194 | _textField.text = [NSString stringWithFormat:@"%.f",number];
195 | }
196 |
197 | [self buttonClickCallBackWithIncreaseStatus:YES];
198 | } else {
199 | if (_shakeAnimation) { [self shakeAnimationMethod]; } PPLog(@"已超过最大数量%.1f",_maxValue);
200 | }
201 | }
202 |
203 | /// 减运算
204 | - (void)decrease
205 | {
206 | [self checkTextFieldNumberWithUpdate];
207 |
208 | CGFloat number = [_textField.text floatValue] - self.stepValue;
209 |
210 | if (number >= _minValue) {
211 | if (self.decimalNum) {
212 | _textField.text = [NSString stringWithFormat:@"%.1f",number];
213 | }else{
214 | _textField.text = [NSString stringWithFormat:@"%.f",number];
215 | }
216 | [self buttonClickCallBackWithIncreaseStatus:NO];
217 | } else {
218 | // 当按钮为"减号按钮隐藏模式",且输入框值 < 设定最小值,减号按钮隐藏
219 | if (_decreaseHide && number<_minValue) {
220 | _textField.hidden = YES;
221 | if (self.decimalNum) {
222 | _textField.text = [NSString stringWithFormat:@"%.1f",_minValue-1];
223 | }else{
224 | _textField.text = [NSString stringWithFormat:@"%.f",_minValue-1];
225 | }
226 |
227 | [self buttonClickCallBackWithIncreaseStatus:NO];
228 | [self rotationAnimationMethod];
229 |
230 | [UIView animateWithDuration:0.3f animations:^{
231 | _decreaseBtn.alpha = 0;
232 | _decreaseBtn.frame = CGRectMake(_width-_height, 0, _height, _height);
233 | }];
234 |
235 | return;
236 | }
237 | if (_shakeAnimation) { [self shakeAnimationMethod]; } PPLog(@"数量不能小于%.1f",_minValue);
238 | }
239 | }
240 |
241 | /// 点击响应
242 | - (void)buttonClickCallBackWithIncreaseStatus:(BOOL)increaseStatus
243 | {
244 | _resultBlock ? _resultBlock(self,_textField.text.floatValue, increaseStatus) : nil;
245 | if ([_delegate respondsToSelector:@selector(pp_numberButton: number: increaseStatus:)]) {
246 | [_delegate pp_numberButton:self number:_textField.text.floatValue increaseStatus:increaseStatus];
247 | }
248 | }
249 |
250 | /// 检查TextField中数字的合法性,并修正
251 | - (void)checkTextFieldNumberWithUpdate
252 | {
253 | NSString *minValueString = nil;
254 | NSString *maxValueString = nil;
255 | if (self.decimalNum) {
256 | minValueString = [NSString stringWithFormat:@"%.1f",_minValue];
257 | maxValueString = [NSString stringWithFormat:@"%.1f",_maxValue];
258 | }else{
259 | minValueString = [NSString stringWithFormat:@"%.f",_minValue];
260 | maxValueString = [NSString stringWithFormat:@"%.f",_maxValue];
261 | }
262 | if ([_textField.text pp_isNotBlank] == NO || [_textField.text floatValue] < _minValue) {
263 | if (self.decimalNum) {
264 | _textField.text = _decreaseHide ? [NSString stringWithFormat:@"%.1f",minValueString.floatValue-self.stepValue]:minValueString;
265 | }else{
266 | _textField.text = _decreaseHide ? [NSString stringWithFormat:@"%.f",minValueString.floatValue-self.stepValue]:minValueString;
267 | }
268 | }
269 | [_textField.text floatValue] > _maxValue ? _textField.text = maxValueString : nil;
270 | }
271 |
272 | /// 清除定时器
273 | - (void)cleanTimer
274 | {
275 | if (_timer.isValid) { [_timer invalidate] ; _timer = nil; }
276 | }
277 |
278 | #pragma mark - 加减按钮的属性设置
279 | - (void)setDecreaseHide:(BOOL)decreaseHide
280 | {
281 | // 当按钮为"减号按钮隐藏模式(饿了么/百度外卖/美团外卖按钮样式)"
282 | if (decreaseHide) {
283 | if (_textField.text.floatValue <= _minValue) {
284 | _textField.hidden = YES;
285 | _decreaseBtn.alpha = 0;
286 |
287 |
288 | if (self.decimalNum) {
289 | _textField.text = [NSString stringWithFormat:@"%.1f",_minValue-1];
290 | }else{
291 | _textField.text = [NSString stringWithFormat:@"%.f",_minValue-1];
292 | }
293 |
294 | _decreaseBtn.frame = CGRectMake(_width-_height, 0, _height, _height);
295 | }
296 | self.backgroundColor = [UIColor clearColor];
297 | } else {
298 | _decreaseBtn.frame = CGRectMake(0, 0, _height, _height);
299 | }
300 | _decreaseHide = decreaseHide;
301 | }
302 |
303 | - (void)setEditing:(BOOL)editing{
304 | _editing = editing;
305 | _textField.enabled = editing;
306 | }
307 |
308 | - (void)setMinValue:(CGFloat)minValue{
309 | _minValue = minValue;
310 | }
311 | -(void)setMaxValue:(CGFloat)maxValue{
312 | _maxValue = maxValue;
313 | }
314 | -(void)setStepValue:(CGFloat)stepValue{
315 | _stepValue = stepValue;
316 | }
317 | -(void)setDecimalNum:(BOOL)decimalNum{
318 | _decimalNum = decimalNum;
319 | }
320 | - (void)setBorderColor:(UIColor *)borderColor{
321 | _borderColor = borderColor;
322 | self.layer.borderWidth = 0.5;
323 | self.layer.borderColor = [borderColor CGColor];
324 |
325 | _decreaseBtn.layer.borderWidth = 0.5;
326 | _decreaseBtn.layer.borderColor = [borderColor CGColor];
327 |
328 | _increaseBtn.layer.borderWidth = 0.5;
329 | _increaseBtn.layer.borderColor = [borderColor CGColor];
330 | }
331 |
332 | - (void)setButtonTitleFont:(CGFloat)buttonTitleFont
333 | {
334 | _buttonTitleFont = buttonTitleFont;
335 | _increaseBtn.titleLabel.font = [UIFont boldSystemFontOfSize:buttonTitleFont];
336 | _decreaseBtn.titleLabel.font = [UIFont boldSystemFontOfSize:buttonTitleFont];
337 | }
338 |
339 | - (void)setIncreaseTitle:(NSString *)increaseTitle
340 | {
341 | _increaseTitle = increaseTitle;
342 | [_increaseBtn setTitle:increaseTitle forState:UIControlStateNormal];
343 | }
344 |
345 | - (void)setDecreaseTitle:(NSString *)decreaseTitle
346 | {
347 | _decreaseTitle = decreaseTitle;
348 | [_decreaseBtn setTitle:decreaseTitle forState:UIControlStateNormal];
349 | }
350 |
351 | - (void)setIncreaseImage:(UIImage *)increaseImage
352 | {
353 | _increaseImage = increaseImage;
354 | [_increaseBtn setBackgroundImage:increaseImage forState:UIControlStateNormal];
355 | }
356 |
357 | - (void)setDecreaseImage:(UIImage *)decreaseImage
358 | {
359 | _decreaseImage = decreaseImage;
360 | [_decreaseBtn setBackgroundImage:decreaseImage forState:UIControlStateNormal];
361 | }
362 |
363 | #pragma mark - 输入框中的内容设置
364 | - (CGFloat)currentNumber { return [_textField.text floatValue]; }
365 |
366 | - (void)setCurrentNumber:(CGFloat)currentNumber
367 | {
368 | if (_decreaseHide && currentNumber < _minValue) {
369 | _textField.hidden = YES;
370 | _decreaseBtn.alpha = 0;
371 | _decreaseBtn.frame = CGRectMake(_width-_height, 0, _height, _height);
372 | } else {
373 | _textField.hidden = NO;
374 | _decreaseBtn.alpha = 1;
375 | _decreaseBtn.frame = CGRectMake(0, 0, _height, _height);
376 | }
377 |
378 | if (self.decimalNum) {
379 | _textField.text = [NSString stringWithFormat:@"%.1f",currentNumber];
380 | }else{
381 | _textField.text = [NSString stringWithFormat:@"%.f",currentNumber];
382 | }
383 |
384 | [self checkTextFieldNumberWithUpdate];
385 | }
386 |
387 | - (void)setInputFieldFont:(CGFloat)inputFieldFont
388 | {
389 | _inputFieldFont = inputFieldFont;
390 | _textField.font = [UIFont systemFontOfSize:inputFieldFont];
391 | }
392 | #pragma mark - 核心动画
393 | /// 抖动动画
394 | - (void)shakeAnimationMethod
395 | {
396 | CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position.x"];
397 | CGFloat positionX = self.layer.position.x;
398 | animation.values = @[@(positionX-10),@(positionX),@(positionX+10)];
399 | animation.repeatCount = 3;
400 | animation.duration = 0.07;
401 | animation.autoreverses = YES;
402 | [self.layer addAnimation:animation forKey:nil];
403 | }
404 | /// 旋转动画
405 | - (void)rotationAnimationMethod
406 | {
407 | CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
408 | rotationAnimation.toValue = @(M_PI*2);
409 | rotationAnimation.duration = 0.3f;
410 | rotationAnimation.fillMode = kCAFillModeForwards;
411 | rotationAnimation.removedOnCompletion = NO;
412 | [_decreaseBtn.layer addAnimation:rotationAnimation forKey:nil];
413 | }
414 | @end
415 |
416 | #pragma mark - NSString分类
417 | @implementation NSString (PPNumberButton)
418 | - (BOOL)pp_isNotBlank
419 | {
420 | NSCharacterSet *blank = [NSCharacterSet whitespaceAndNewlineCharacterSet];
421 | for (NSInteger i = 0; i < self.length; ++i) {
422 | unichar c = [self characterAtIndex:i];
423 | if (![blank characterIsMember:c]) {
424 | return YES;
425 | }
426 | }
427 | return NO;
428 | }
429 |
430 | @end
431 |
432 |
--------------------------------------------------------------------------------
/PPNumberButton.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1DCCB5B71F0CE0E900FF5F50 /* PPHomePageController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DCCB5B21F0CE0E900FF5F50 /* PPHomePageController.m */; };
11 | 1DCCB5B81F0CE0E900FF5F50 /* PPViewController1.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DCCB5B41F0CE0E900FF5F50 /* PPViewController1.m */; };
12 | 1DCCB5B91F0CE0E900FF5F50 /* PPViewController2.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DCCB5B61F0CE0E900FF5F50 /* PPViewController2.m */; };
13 | 1DCCB5C31F0CE3A500FF5F50 /* PPTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DCCB5C11F0CE3A500FF5F50 /* PPTableViewCell.m */; };
14 | 1DCCB5C41F0CE3A500FF5F50 /* PPTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DCCB5C21F0CE3A500FF5F50 /* PPTableViewCell.xib */; };
15 | 2281A76A1D7669C90094E113 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2281A7691D7669C90094E113 /* main.m */; };
16 | 2281A76D1D7669CA0094E113 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2281A76C1D7669CA0094E113 /* AppDelegate.m */; };
17 | 2281A7731D7669CA0094E113 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2281A7711D7669CA0094E113 /* Main.storyboard */; };
18 | 2281A7751D7669CA0094E113 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2281A7741D7669CA0094E113 /* Assets.xcassets */; };
19 | 2281A7781D7669CA0094E113 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2281A7761D7669CA0094E113 /* LaunchScreen.storyboard */; };
20 | 2281A7831D7669CA0094E113 /* PPNumberButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2281A7821D7669CA0094E113 /* PPNumberButtonTests.m */; };
21 | 22A9A90B1D76AFB100BA2FF5 /* PPNumberButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22A9A90A1D76AFB100BA2FF5 /* PPNumberButton.m */; };
22 | 702BEDBB202C115B00584286 /* PPViewController3.m in Sources */ = {isa = PBXBuildFile; fileRef = 702BEDBA202C115B00584286 /* PPViewController3.m */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXContainerItemProxy section */
26 | 2281A77F1D7669CA0094E113 /* PBXContainerItemProxy */ = {
27 | isa = PBXContainerItemProxy;
28 | containerPortal = 2281A75D1D7669C90094E113 /* Project object */;
29 | proxyType = 1;
30 | remoteGlobalIDString = 2281A7641D7669C90094E113;
31 | remoteInfo = PPNumberButton;
32 | };
33 | /* End PBXContainerItemProxy section */
34 |
35 | /* Begin PBXFileReference section */
36 | 1DCCB5B11F0CE0E900FF5F50 /* PPHomePageController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPHomePageController.h; sourceTree = ""; };
37 | 1DCCB5B21F0CE0E900FF5F50 /* PPHomePageController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPHomePageController.m; sourceTree = ""; };
38 | 1DCCB5B31F0CE0E900FF5F50 /* PPViewController1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPViewController1.h; sourceTree = ""; };
39 | 1DCCB5B41F0CE0E900FF5F50 /* PPViewController1.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPViewController1.m; sourceTree = ""; };
40 | 1DCCB5B51F0CE0E900FF5F50 /* PPViewController2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPViewController2.h; sourceTree = ""; };
41 | 1DCCB5B61F0CE0E900FF5F50 /* PPViewController2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPViewController2.m; sourceTree = ""; };
42 | 1DCCB5C01F0CE3A500FF5F50 /* PPTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPTableViewCell.h; sourceTree = ""; };
43 | 1DCCB5C11F0CE3A500FF5F50 /* PPTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPTableViewCell.m; sourceTree = ""; };
44 | 1DCCB5C21F0CE3A500FF5F50 /* PPTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PPTableViewCell.xib; sourceTree = ""; };
45 | 2281A7651D7669C90094E113 /* PPNumberButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PPNumberButton.app; sourceTree = BUILT_PRODUCTS_DIR; };
46 | 2281A7691D7669C90094E113 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
47 | 2281A76B1D7669CA0094E113 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
48 | 2281A76C1D7669CA0094E113 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
49 | 2281A7721D7669CA0094E113 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
50 | 2281A7741D7669CA0094E113 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
51 | 2281A7771D7669CA0094E113 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
52 | 2281A7791D7669CA0094E113 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
53 | 2281A77E1D7669CA0094E113 /* PPNumberButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PPNumberButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
54 | 2281A7821D7669CA0094E113 /* PPNumberButtonTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PPNumberButtonTests.m; sourceTree = ""; };
55 | 2281A7841D7669CA0094E113 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
56 | 22A9A9091D76AFB100BA2FF5 /* PPNumberButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPNumberButton.h; sourceTree = ""; };
57 | 22A9A90A1D76AFB100BA2FF5 /* PPNumberButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPNumberButton.m; sourceTree = ""; };
58 | 702BEDB9202C115B00584286 /* PPViewController3.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PPViewController3.h; sourceTree = ""; };
59 | 702BEDBA202C115B00584286 /* PPViewController3.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PPViewController3.m; sourceTree = ""; };
60 | /* End PBXFileReference section */
61 |
62 | /* Begin PBXFrameworksBuildPhase section */
63 | 2281A7621D7669C90094E113 /* Frameworks */ = {
64 | isa = PBXFrameworksBuildPhase;
65 | buildActionMask = 2147483647;
66 | files = (
67 | );
68 | runOnlyForDeploymentPostprocessing = 0;
69 | };
70 | 2281A77B1D7669CA0094E113 /* Frameworks */ = {
71 | isa = PBXFrameworksBuildPhase;
72 | buildActionMask = 2147483647;
73 | files = (
74 | );
75 | runOnlyForDeploymentPostprocessing = 0;
76 | };
77 | /* End PBXFrameworksBuildPhase section */
78 |
79 | /* Begin PBXGroup section */
80 | 1DCCB5B01F0CE0E900FF5F50 /* Controller */ = {
81 | isa = PBXGroup;
82 | children = (
83 | 1DCCB5B11F0CE0E900FF5F50 /* PPHomePageController.h */,
84 | 1DCCB5B21F0CE0E900FF5F50 /* PPHomePageController.m */,
85 | 1DCCB5B31F0CE0E900FF5F50 /* PPViewController1.h */,
86 | 1DCCB5B41F0CE0E900FF5F50 /* PPViewController1.m */,
87 | 1DCCB5B51F0CE0E900FF5F50 /* PPViewController2.h */,
88 | 1DCCB5B61F0CE0E900FF5F50 /* PPViewController2.m */,
89 | 702BEDB9202C115B00584286 /* PPViewController3.h */,
90 | 702BEDBA202C115B00584286 /* PPViewController3.m */,
91 | );
92 | path = Controller;
93 | sourceTree = "";
94 | };
95 | 1DCCB5BA1F0CE0F000FF5F50 /* View */ = {
96 | isa = PBXGroup;
97 | children = (
98 | 1DCCB5C01F0CE3A500FF5F50 /* PPTableViewCell.h */,
99 | 1DCCB5C11F0CE3A500FF5F50 /* PPTableViewCell.m */,
100 | 1DCCB5C21F0CE3A500FF5F50 /* PPTableViewCell.xib */,
101 | );
102 | path = View;
103 | sourceTree = "";
104 | };
105 | 2281A75C1D7669C90094E113 = {
106 | isa = PBXGroup;
107 | children = (
108 | 2281A7671D7669C90094E113 /* PPNumberButton */,
109 | 2281A7811D7669CA0094E113 /* PPNumberButtonTests */,
110 | 2281A7661D7669C90094E113 /* Products */,
111 | );
112 | sourceTree = "";
113 | };
114 | 2281A7661D7669C90094E113 /* Products */ = {
115 | isa = PBXGroup;
116 | children = (
117 | 2281A7651D7669C90094E113 /* PPNumberButton.app */,
118 | 2281A77E1D7669CA0094E113 /* PPNumberButtonTests.xctest */,
119 | );
120 | name = Products;
121 | sourceTree = "";
122 | };
123 | 2281A7671D7669C90094E113 /* PPNumberButton */ = {
124 | isa = PBXGroup;
125 | children = (
126 | 22A9A9081D76AFB100BA2FF5 /* PPNumberButton */,
127 | 1DCCB5BA1F0CE0F000FF5F50 /* View */,
128 | 1DCCB5B01F0CE0E900FF5F50 /* Controller */,
129 | 2281A7711D7669CA0094E113 /* Main.storyboard */,
130 | 2281A7681D7669C90094E113 /* Supporting Files */,
131 | );
132 | path = PPNumberButton;
133 | sourceTree = "";
134 | };
135 | 2281A7681D7669C90094E113 /* Supporting Files */ = {
136 | isa = PBXGroup;
137 | children = (
138 | 2281A76B1D7669CA0094E113 /* AppDelegate.h */,
139 | 2281A76C1D7669CA0094E113 /* AppDelegate.m */,
140 | 2281A7741D7669CA0094E113 /* Assets.xcassets */,
141 | 2281A7761D7669CA0094E113 /* LaunchScreen.storyboard */,
142 | 2281A7791D7669CA0094E113 /* Info.plist */,
143 | 2281A7691D7669C90094E113 /* main.m */,
144 | );
145 | name = "Supporting Files";
146 | sourceTree = "";
147 | };
148 | 2281A7811D7669CA0094E113 /* PPNumberButtonTests */ = {
149 | isa = PBXGroup;
150 | children = (
151 | 2281A7821D7669CA0094E113 /* PPNumberButtonTests.m */,
152 | 2281A7841D7669CA0094E113 /* Info.plist */,
153 | );
154 | path = PPNumberButtonTests;
155 | sourceTree = "";
156 | };
157 | 22A9A9081D76AFB100BA2FF5 /* PPNumberButton */ = {
158 | isa = PBXGroup;
159 | children = (
160 | 22A9A9091D76AFB100BA2FF5 /* PPNumberButton.h */,
161 | 22A9A90A1D76AFB100BA2FF5 /* PPNumberButton.m */,
162 | );
163 | path = PPNumberButton;
164 | sourceTree = "";
165 | };
166 | /* End PBXGroup section */
167 |
168 | /* Begin PBXNativeTarget section */
169 | 2281A7641D7669C90094E113 /* PPNumberButton */ = {
170 | isa = PBXNativeTarget;
171 | buildConfigurationList = 2281A7871D7669CA0094E113 /* Build configuration list for PBXNativeTarget "PPNumberButton" */;
172 | buildPhases = (
173 | 2281A7611D7669C90094E113 /* Sources */,
174 | 2281A7621D7669C90094E113 /* Frameworks */,
175 | 2281A7631D7669C90094E113 /* Resources */,
176 | );
177 | buildRules = (
178 | );
179 | dependencies = (
180 | );
181 | name = PPNumberButton;
182 | productName = PPNumberButton;
183 | productReference = 2281A7651D7669C90094E113 /* PPNumberButton.app */;
184 | productType = "com.apple.product-type.application";
185 | };
186 | 2281A77D1D7669CA0094E113 /* PPNumberButtonTests */ = {
187 | isa = PBXNativeTarget;
188 | buildConfigurationList = 2281A78A1D7669CA0094E113 /* Build configuration list for PBXNativeTarget "PPNumberButtonTests" */;
189 | buildPhases = (
190 | 2281A77A1D7669CA0094E113 /* Sources */,
191 | 2281A77B1D7669CA0094E113 /* Frameworks */,
192 | 2281A77C1D7669CA0094E113 /* Resources */,
193 | );
194 | buildRules = (
195 | );
196 | dependencies = (
197 | 2281A7801D7669CA0094E113 /* PBXTargetDependency */,
198 | );
199 | name = PPNumberButtonTests;
200 | productName = PPNumberButtonTests;
201 | productReference = 2281A77E1D7669CA0094E113 /* PPNumberButtonTests.xctest */;
202 | productType = "com.apple.product-type.bundle.unit-test";
203 | };
204 | /* End PBXNativeTarget section */
205 |
206 | /* Begin PBXProject section */
207 | 2281A75D1D7669C90094E113 /* Project object */ = {
208 | isa = PBXProject;
209 | attributes = {
210 | LastUpgradeCheck = 0730;
211 | ORGANIZATIONNAME = AndyPang;
212 | TargetAttributes = {
213 | 2281A7641D7669C90094E113 = {
214 | CreatedOnToolsVersion = 7.3.1;
215 | DevelopmentTeam = 7D992WX2BB;
216 | };
217 | 2281A77D1D7669CA0094E113 = {
218 | CreatedOnToolsVersion = 7.3.1;
219 | TestTargetID = 2281A7641D7669C90094E113;
220 | };
221 | };
222 | };
223 | buildConfigurationList = 2281A7601D7669C90094E113 /* Build configuration list for PBXProject "PPNumberButton" */;
224 | compatibilityVersion = "Xcode 3.2";
225 | developmentRegion = English;
226 | hasScannedForEncodings = 0;
227 | knownRegions = (
228 | en,
229 | Base,
230 | );
231 | mainGroup = 2281A75C1D7669C90094E113;
232 | productRefGroup = 2281A7661D7669C90094E113 /* Products */;
233 | projectDirPath = "";
234 | projectRoot = "";
235 | targets = (
236 | 2281A7641D7669C90094E113 /* PPNumberButton */,
237 | 2281A77D1D7669CA0094E113 /* PPNumberButtonTests */,
238 | );
239 | };
240 | /* End PBXProject section */
241 |
242 | /* Begin PBXResourcesBuildPhase section */
243 | 2281A7631D7669C90094E113 /* Resources */ = {
244 | isa = PBXResourcesBuildPhase;
245 | buildActionMask = 2147483647;
246 | files = (
247 | 2281A7781D7669CA0094E113 /* LaunchScreen.storyboard in Resources */,
248 | 2281A7751D7669CA0094E113 /* Assets.xcassets in Resources */,
249 | 2281A7731D7669CA0094E113 /* Main.storyboard in Resources */,
250 | 1DCCB5C41F0CE3A500FF5F50 /* PPTableViewCell.xib in Resources */,
251 | );
252 | runOnlyForDeploymentPostprocessing = 0;
253 | };
254 | 2281A77C1D7669CA0094E113 /* Resources */ = {
255 | isa = PBXResourcesBuildPhase;
256 | buildActionMask = 2147483647;
257 | files = (
258 | );
259 | runOnlyForDeploymentPostprocessing = 0;
260 | };
261 | /* End PBXResourcesBuildPhase section */
262 |
263 | /* Begin PBXSourcesBuildPhase section */
264 | 2281A7611D7669C90094E113 /* Sources */ = {
265 | isa = PBXSourcesBuildPhase;
266 | buildActionMask = 2147483647;
267 | files = (
268 | 702BEDBB202C115B00584286 /* PPViewController3.m in Sources */,
269 | 22A9A90B1D76AFB100BA2FF5 /* PPNumberButton.m in Sources */,
270 | 1DCCB5C31F0CE3A500FF5F50 /* PPTableViewCell.m in Sources */,
271 | 1DCCB5B91F0CE0E900FF5F50 /* PPViewController2.m in Sources */,
272 | 2281A76D1D7669CA0094E113 /* AppDelegate.m in Sources */,
273 | 2281A76A1D7669C90094E113 /* main.m in Sources */,
274 | 1DCCB5B81F0CE0E900FF5F50 /* PPViewController1.m in Sources */,
275 | 1DCCB5B71F0CE0E900FF5F50 /* PPHomePageController.m in Sources */,
276 | );
277 | runOnlyForDeploymentPostprocessing = 0;
278 | };
279 | 2281A77A1D7669CA0094E113 /* Sources */ = {
280 | isa = PBXSourcesBuildPhase;
281 | buildActionMask = 2147483647;
282 | files = (
283 | 2281A7831D7669CA0094E113 /* PPNumberButtonTests.m in Sources */,
284 | );
285 | runOnlyForDeploymentPostprocessing = 0;
286 | };
287 | /* End PBXSourcesBuildPhase section */
288 |
289 | /* Begin PBXTargetDependency section */
290 | 2281A7801D7669CA0094E113 /* PBXTargetDependency */ = {
291 | isa = PBXTargetDependency;
292 | target = 2281A7641D7669C90094E113 /* PPNumberButton */;
293 | targetProxy = 2281A77F1D7669CA0094E113 /* PBXContainerItemProxy */;
294 | };
295 | /* End PBXTargetDependency section */
296 |
297 | /* Begin PBXVariantGroup section */
298 | 2281A7711D7669CA0094E113 /* Main.storyboard */ = {
299 | isa = PBXVariantGroup;
300 | children = (
301 | 2281A7721D7669CA0094E113 /* Base */,
302 | );
303 | name = Main.storyboard;
304 | sourceTree = "";
305 | };
306 | 2281A7761D7669CA0094E113 /* LaunchScreen.storyboard */ = {
307 | isa = PBXVariantGroup;
308 | children = (
309 | 2281A7771D7669CA0094E113 /* Base */,
310 | );
311 | name = LaunchScreen.storyboard;
312 | sourceTree = "";
313 | };
314 | /* End PBXVariantGroup section */
315 |
316 | /* Begin XCBuildConfiguration section */
317 | 2281A7851D7669CA0094E113 /* Debug */ = {
318 | isa = XCBuildConfiguration;
319 | buildSettings = {
320 | ALWAYS_SEARCH_USER_PATHS = NO;
321 | CLANG_ANALYZER_NONNULL = YES;
322 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
323 | CLANG_CXX_LIBRARY = "libc++";
324 | CLANG_ENABLE_MODULES = YES;
325 | CLANG_ENABLE_OBJC_ARC = YES;
326 | CLANG_WARN_BOOL_CONVERSION = YES;
327 | CLANG_WARN_CONSTANT_CONVERSION = YES;
328 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
329 | CLANG_WARN_EMPTY_BODY = YES;
330 | CLANG_WARN_ENUM_CONVERSION = YES;
331 | CLANG_WARN_INT_CONVERSION = YES;
332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
333 | CLANG_WARN_UNREACHABLE_CODE = YES;
334 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
335 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
336 | COPY_PHASE_STRIP = NO;
337 | DEBUG_INFORMATION_FORMAT = dwarf;
338 | ENABLE_STRICT_OBJC_MSGSEND = YES;
339 | ENABLE_TESTABILITY = YES;
340 | GCC_C_LANGUAGE_STANDARD = gnu99;
341 | GCC_DYNAMIC_NO_PIC = NO;
342 | GCC_NO_COMMON_BLOCKS = YES;
343 | GCC_OPTIMIZATION_LEVEL = 0;
344 | GCC_PREPROCESSOR_DEFINITIONS = (
345 | "DEBUG=1",
346 | "$(inherited)",
347 | );
348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
350 | GCC_WARN_UNDECLARED_SELECTOR = YES;
351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
352 | GCC_WARN_UNUSED_FUNCTION = YES;
353 | GCC_WARN_UNUSED_VARIABLE = YES;
354 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
355 | MTL_ENABLE_DEBUG_INFO = YES;
356 | ONLY_ACTIVE_ARCH = YES;
357 | SDKROOT = iphoneos;
358 | TARGETED_DEVICE_FAMILY = "1,2";
359 | };
360 | name = Debug;
361 | };
362 | 2281A7861D7669CA0094E113 /* Release */ = {
363 | isa = XCBuildConfiguration;
364 | buildSettings = {
365 | ALWAYS_SEARCH_USER_PATHS = NO;
366 | CLANG_ANALYZER_NONNULL = YES;
367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
368 | CLANG_CXX_LIBRARY = "libc++";
369 | CLANG_ENABLE_MODULES = YES;
370 | CLANG_ENABLE_OBJC_ARC = YES;
371 | CLANG_WARN_BOOL_CONVERSION = YES;
372 | CLANG_WARN_CONSTANT_CONVERSION = YES;
373 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
374 | CLANG_WARN_EMPTY_BODY = YES;
375 | CLANG_WARN_ENUM_CONVERSION = YES;
376 | CLANG_WARN_INT_CONVERSION = YES;
377 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
378 | CLANG_WARN_UNREACHABLE_CODE = YES;
379 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
380 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
381 | COPY_PHASE_STRIP = NO;
382 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
383 | ENABLE_NS_ASSERTIONS = NO;
384 | ENABLE_STRICT_OBJC_MSGSEND = YES;
385 | GCC_C_LANGUAGE_STANDARD = gnu99;
386 | GCC_NO_COMMON_BLOCKS = YES;
387 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
388 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
389 | GCC_WARN_UNDECLARED_SELECTOR = YES;
390 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
391 | GCC_WARN_UNUSED_FUNCTION = YES;
392 | GCC_WARN_UNUSED_VARIABLE = YES;
393 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
394 | MTL_ENABLE_DEBUG_INFO = NO;
395 | SDKROOT = iphoneos;
396 | TARGETED_DEVICE_FAMILY = "1,2";
397 | VALIDATE_PRODUCT = YES;
398 | };
399 | name = Release;
400 | };
401 | 2281A7881D7669CA0094E113 /* Debug */ = {
402 | isa = XCBuildConfiguration;
403 | buildSettings = {
404 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
405 | CODE_SIGN_IDENTITY = "iPhone Developer";
406 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
407 | DEVELOPMENT_TEAM = 7D992WX2BB;
408 | INFOPLIST_FILE = PPNumberButton/Info.plist;
409 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
411 | PRODUCT_BUNDLE_IDENTIFIER = com.jkpang.PPNumberButton;
412 | PRODUCT_NAME = "$(TARGET_NAME)";
413 | PROVISIONING_PROFILE = "";
414 | };
415 | name = Debug;
416 | };
417 | 2281A7891D7669CA0094E113 /* Release */ = {
418 | isa = XCBuildConfiguration;
419 | buildSettings = {
420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
421 | CODE_SIGN_IDENTITY = "iPhone Developer";
422 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
423 | DEVELOPMENT_TEAM = 7D992WX2BB;
424 | INFOPLIST_FILE = PPNumberButton/Info.plist;
425 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
426 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
427 | PRODUCT_BUNDLE_IDENTIFIER = com.jkpang.PPNumberButton;
428 | PRODUCT_NAME = "$(TARGET_NAME)";
429 | PROVISIONING_PROFILE = "";
430 | };
431 | name = Release;
432 | };
433 | 2281A78B1D7669CA0094E113 /* Debug */ = {
434 | isa = XCBuildConfiguration;
435 | buildSettings = {
436 | BUNDLE_LOADER = "$(TEST_HOST)";
437 | INFOPLIST_FILE = PPNumberButtonTests/Info.plist;
438 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
439 | PRODUCT_BUNDLE_IDENTIFIER = com.jkpang.PPNumberButtonTests;
440 | PRODUCT_NAME = "$(TARGET_NAME)";
441 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PPNumberButton.app/PPNumberButton";
442 | };
443 | name = Debug;
444 | };
445 | 2281A78C1D7669CA0094E113 /* Release */ = {
446 | isa = XCBuildConfiguration;
447 | buildSettings = {
448 | BUNDLE_LOADER = "$(TEST_HOST)";
449 | INFOPLIST_FILE = PPNumberButtonTests/Info.plist;
450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
451 | PRODUCT_BUNDLE_IDENTIFIER = com.jkpang.PPNumberButtonTests;
452 | PRODUCT_NAME = "$(TARGET_NAME)";
453 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PPNumberButton.app/PPNumberButton";
454 | };
455 | name = Release;
456 | };
457 | /* End XCBuildConfiguration section */
458 |
459 | /* Begin XCConfigurationList section */
460 | 2281A7601D7669C90094E113 /* Build configuration list for PBXProject "PPNumberButton" */ = {
461 | isa = XCConfigurationList;
462 | buildConfigurations = (
463 | 2281A7851D7669CA0094E113 /* Debug */,
464 | 2281A7861D7669CA0094E113 /* Release */,
465 | );
466 | defaultConfigurationIsVisible = 0;
467 | defaultConfigurationName = Release;
468 | };
469 | 2281A7871D7669CA0094E113 /* Build configuration list for PBXNativeTarget "PPNumberButton" */ = {
470 | isa = XCConfigurationList;
471 | buildConfigurations = (
472 | 2281A7881D7669CA0094E113 /* Debug */,
473 | 2281A7891D7669CA0094E113 /* Release */,
474 | );
475 | defaultConfigurationIsVisible = 0;
476 | defaultConfigurationName = Release;
477 | };
478 | 2281A78A1D7669CA0094E113 /* Build configuration list for PBXNativeTarget "PPNumberButtonTests" */ = {
479 | isa = XCConfigurationList;
480 | buildConfigurations = (
481 | 2281A78B1D7669CA0094E113 /* Debug */,
482 | 2281A78C1D7669CA0094E113 /* Release */,
483 | );
484 | defaultConfigurationIsVisible = 0;
485 | defaultConfigurationName = Release;
486 | };
487 | /* End XCConfigurationList section */
488 | };
489 | rootObject = 2281A75D1D7669C90094E113 /* Project object */;
490 | }
491 |
--------------------------------------------------------------------------------