├── STPickerView.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ └── STPickerView.xcscheme └── project.pbxproj ├── CHANGELOG.md ├── STPickerDemo ├── STPickerDemo │ ├── ViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── AppDelegate.m │ ├── ViewController.m │ └── Main.storyboard └── STPickerDemo.xcodeproj │ └── project.pbxproj ├── STPickerView.podspec ├── STPickerView.xcworkspace └── contents.xcworkspacedata ├── STPickerView ├── STPickerView │ ├── STPickerViewUI.m │ ├── STPickerViewUI.h │ ├── STPickerArea.h │ ├── STPickerDate.h │ ├── STPickerSingle.h │ ├── UIView+STPicker.h │ ├── NSCalendar+STPicker.h │ ├── STPickerView.h │ ├── UIView+STPicker.m │ ├── STPickerSingle.m │ ├── STPickerDate.m │ ├── NSCalendar+STPicker.m │ ├── STPickerArea.m │ └── STPickerView.m └── FramewordInfo │ └── Info.plist ├── LICENSE ├── .gitignore └── README.md /STPickerView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 版本信息 2 | 3 | ## 2.4 4 | 1. 修复iphonePlus的显示问题 5 | 6 | ## 2.3 7 | 1. 地区选择器添加记录之前地区接口 8 | 9 | ## 2.2 10 | 1. 修改日期选择的问题 11 | 12 | ## 2.1 13 | 1. 支持横竖屏 14 | 2. 修改日期选择的问题 15 | 3. 优化界面 16 | 17 | ## 2.0 18 | 1. 添加Carthage的支持 19 | 20 | ## 1.0.0 21 | 1. 支持城市,时间,单项选择 22 | 2. 支持中间和下方显示 23 | 24 | 25 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // STPickerViewTest 4 | // 5 | // Created by ST on 16/11/3. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // STPickerViewTest 4 | // 5 | // Created by ST on 16/11/3. 6 | // Copyright © 2016年 ST. 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 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // STPickerDemo 4 | // 5 | // Created by ST on 17/5/5. 6 | // Copyright © 2017年 ST. 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 | -------------------------------------------------------------------------------- /STPickerView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'STPickerView' 3 | s.version = '2.4' 4 | s.license = { :type => 'MIT', :file => 'LICENSE'} 5 | s.summary = '一个多功能的选择器,有城市选择,日期选择和单数组源自定的功能' 6 | s.homepage = 'https://github.com/STShenZhaoliang' 7 | s.author = { 'STShenZhaoliang' => '409178030@qq.com' } 8 | s.source = { 9 | :git => 'https://github.com/STShenZhaoliang/STPickerView.git', 10 | :tag => s.version.to_s 11 | } 12 | s.ios.deployment_target = '7.0' 13 | s.source_files = "STPickerView/STPickerView/*.{h,m}" 14 | s.resource = 'STPickerView/Resource/area.plist' 15 | s.requires_arc = true 16 | end 17 | -------------------------------------------------------------------------------- /STPickerView.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 18 | 19 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerViewUI.m: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerViewUI.m 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/16. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import "STPickerViewUI.h" 10 | 11 | /** 1.统一的较小间距 5*/ 12 | CGFloat const STMarginSmall = 5; 13 | 14 | /** 2.统一的间距 10*/ 15 | CGFloat const STMargin = 10; 16 | 17 | /** 3.统一的较大间距 16*/ 18 | CGFloat const STMarginBig = 16; 19 | 20 | /** 4.导航栏的最大的Y值 64*/ 21 | CGFloat const STNavigationBarY = 64; 22 | 23 | /** 5.控件的系统高度 44*/ 24 | CGFloat const STControlSystemHeight = 44; 25 | 26 | /** 6.控件的普通高度 36*/ 27 | CGFloat const STControlNormalHeight = 36; 28 | 29 | /** 7.按钮的系统宽度 64*/ 30 | CGFloat const STButtonSystemHeight = 64; 31 | 32 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerViewUI.h: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerViewUI.h 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/16. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /** 1.统一的较小间距 5 */ 13 | UIKIT_EXTERN CGFloat const STMarginSmall; 14 | 15 | /** 2.统一的间距 10 */ 16 | UIKIT_EXTERN CGFloat const STMargin; 17 | 18 | /** 3.统一的较大间距 16 */ 19 | UIKIT_EXTERN CGFloat const STMarginBig; 20 | 21 | /** 4.导航栏的最大的Y值 64 */ 22 | UIKIT_EXTERN CGFloat const STNavigationBarY; 23 | 24 | /** 5.控件的系统高度 44 */ 25 | UIKIT_EXTERN CGFloat const STControlSystemHeight; 26 | 27 | /** 6.控件的普通高度 36 */ 28 | UIKIT_EXTERN CGFloat const STControlNormalHeight; 29 | 30 | /** 7.按钮的系统宽度 64*/ 31 | UIKIT_EXTERN CGFloat const STButtonSystemHeight; 32 | -------------------------------------------------------------------------------- /STPickerView/FramewordInfo/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerArea.h: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerArea.h 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/15. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "STPickerView.h" 11 | NS_ASSUME_NONNULL_BEGIN 12 | @class STPickerArea; 13 | @protocol STPickerAreaDelegate 14 | 15 | - (void)pickerArea:(STPickerArea *)pickerArea province:(NSString *)province city:(NSString *)city area:(NSString *)area; 16 | 17 | @end 18 | @interface STPickerArea : STPickerView 19 | /** 1.中间选择框的高度,default is 32*/ 20 | @property(nonatomic, assign)CGFloat heightPickerComponent; 21 | /** 2.保存之前的选择地址,default is NO */ 22 | @property(nonatomic, assign, getter=isSaveHistory)BOOL saveHistory; 23 | 24 | @property(nonatomic, weak)id delegate; 25 | 26 | @end 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerDate.h: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerDate.h 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/16. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import "STPickerView.h" 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @class STPickerDate; 13 | @protocol STPickerDateDelegate 14 | - (void)pickerDate:(STPickerDate *)pickerDate year:(NSInteger)year month:(NSInteger)month day:(NSInteger)day; 15 | 16 | @end 17 | @interface STPickerDate : STPickerView 18 | 19 | /** 1.最小的年份,default is 1900 */ 20 | @property (nonatomic, assign)NSInteger yearLeast; 21 | /** 2.显示年份数量,default is 200 */ 22 | @property (nonatomic, assign)NSInteger yearSum; 23 | /** 3.中间选择框的高度,default is 28*/ 24 | @property (nonatomic, assign)CGFloat heightPickerComponent; 25 | 26 | @property(nonatomic, weak)id delegate ; 27 | 28 | @end 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerSingle.h: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerSingle.h 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/16. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import "STPickerView.h" 10 | NS_ASSUME_NONNULL_BEGIN 11 | @class STPickerSingle; 12 | @protocol STPickerSingleDelegate 13 | - (void)pickerSingle:(STPickerSingle *)pickerSingle selectedTitle:(NSString *)selectedTitle; 14 | @end 15 | 16 | @interface STPickerSingle : STPickerView 17 | 18 | /** 1.设置字符串数据数组 */ 19 | @property (nonatomic, strong)NSMutableArray *arrayData; 20 | /** 2.设置单位标题 */ 21 | @property (nonatomic, strong)NSString *titleUnit; 22 | /** 3.中间选择框的高度,default is 44*/ 23 | @property (nonatomic, assign)CGFloat heightPickerComponent; 24 | /** 4.中间选择框的宽度,default is 32*/ 25 | @property (nonatomic, assign)CGFloat widthPickerComponent; 26 | @property(nonatomic, weak)id delegate; 27 | 28 | @end 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/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 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 沈天 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 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/UIView+STPicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+STFrame.h 3 | // STPickerView 4 | // 5 | // Created by ST on 16/10/31. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (STPicker) 12 | 13 | /** 1.间隔X值 */ 14 | @property (nonatomic, assign) CGFloat st_x; 15 | 16 | /** 2.间隔Y值 */ 17 | @property (nonatomic, assign) CGFloat st_y; 18 | 19 | /** 3.宽度 */ 20 | @property (nonatomic, assign) CGFloat st_width; 21 | 22 | /** 4.高度 */ 23 | @property (nonatomic, assign) CGFloat st_height; 24 | 25 | /** 5.中心点X值 */ 26 | @property (nonatomic, assign) CGFloat st_centerX; 27 | 28 | /** 6.中心点Y值 */ 29 | @property (nonatomic, assign) CGFloat st_centerY; 30 | 31 | /** 7.尺寸大小 */ 32 | @property (nonatomic, assign) CGSize st_size; 33 | 34 | /** 8.起始点 */ 35 | @property (nonatomic, assign) CGPoint st_origin; 36 | 37 | /** 9.上 */ 38 | @property (nonatomic) CGFloat st_top; 39 | 40 | /** 10.下 */ 41 | @property (nonatomic) CGFloat st_bottom; 42 | 43 | /** 11.左 */ 44 | @property (nonatomic) CGFloat st_left; 45 | 46 | /** 12.右 */ 47 | @property (nonatomic) CGFloat st_right; 48 | 49 | /** 50 | * 1.添加边框 51 | * 52 | * @param color <#color description#> 53 | */ 54 | - (void)addBorderColor:(UIColor *)color; 55 | 56 | @end 57 | 58 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/NSCalendar+STPicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSCalendar+ST.h 3 | // STCalendarDemo 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STCalendar on 15/12/17. 6 | // Copyright © 2015年 ST. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSCalendar (STPicker) 12 | 13 | /** 1.当前的日期数据元件模型 */ 14 | + (NSDateComponents *)currentDateComponents; 15 | 16 | /** 2.当前年 */ 17 | + (NSInteger)currentYear; 18 | 19 | /** 3.当前月 */ 20 | + (NSInteger)currentMonth; 21 | 22 | /** 4.当前天 */ 23 | + (NSInteger)currentDay; 24 | 25 | /** 5.当前周数 */ 26 | + (NSInteger)currnentWeekday; 27 | 28 | /** 6.获取指定年月的天数 */ 29 | + (NSInteger)getDaysWithYear:(NSInteger)year month:(NSInteger)month; 30 | 31 | /** 7.获取指定年月的第一天的周数 */ 32 | + (NSInteger)getFirstWeekdayWithYear:(NSInteger)year month:(NSInteger)month; 33 | 34 | /** 8.比较两个日期元件 */ 35 | + (NSComparisonResult)compareWithComponentsOne:(NSDateComponents *)componentsOne componentsTwo:(NSDateComponents *)componentsTwo; 36 | 37 | /** 9.获取两个日期元件之间的日期元件 */ 38 | + (NSMutableArray *)arrayComponentsWithComponentsOne:(NSDateComponents *)componentsOne componentsTwo:(NSDateComponents *)componentsTwo; 39 | 40 | /** 10.字符串转日期元件 字符串格式为:yy-MM-dd */ 41 | + (NSDateComponents *)dateComponentsWithString:(NSString *)String; 42 | @end 43 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /.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 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/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 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerView.h 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/17. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "STPickerViewUI.h" 11 | #import "UIView+STPicker.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | typedef NS_ENUM(NSInteger, STPickerContentMode) { 16 | STPickerContentModeBottom, // 1.选择器在视图的下方 17 | STPickerContentModeCenter // 2.选择器在视图的中间 18 | }; 19 | 20 | @interface STPickerView : UIButton 21 | 22 | /** 1.内部视图 */ 23 | @property (nonatomic, strong) UIView *contentView; 24 | /** 2.边线,选择器和上方tool之间的边线 */ 25 | @property (nonatomic, strong)UIView *lineView; 26 | /** 3.选择器 */ 27 | @property (nonatomic, strong)UIPickerView *pickerView; 28 | /** 4.左边的按钮 */ 29 | @property (nonatomic, strong)UIButton *buttonLeft; 30 | /** 5.右边的按钮 */ 31 | @property (nonatomic, strong)UIButton *buttonRight; 32 | /** 6.标题label */ 33 | @property (nonatomic, strong)UILabel *labelTitle; 34 | /** 7.下边线,在显示模式是STPickerContentModeCenter的时候显示 */ 35 | @property (nonatomic, strong)UIView *lineViewDown; 36 | 37 | /** 1.标题,default is nil */ 38 | @property(nullable, nonatomic,copy) NSString *title; 39 | /** 2.字体,default is nil (system font 17 plain) */ 40 | @property(null_resettable, nonatomic,strong) UIFont *font; 41 | /** 3.字体颜色,default is nil (text draws black) */ 42 | @property(null_resettable, nonatomic,strong) UIColor *titleColor; 43 | /** 4.按钮边框颜色颜色,default is RGB(205, 205, 205) */ 44 | @property(null_resettable, nonatomic,strong) UIColor *borderButtonColor; 45 | /** 5.选择器的高度,default is 240 */ 46 | @property (nonatomic, assign)CGFloat heightPicker; 47 | /** 6.视图的显示模式 */ 48 | @property (nonatomic, assign)STPickerContentMode contentMode; 49 | 50 | 51 | /** 52 | * 5.创建视图,初始化视图时初始数据 53 | */ 54 | - (void)setupUI; 55 | 56 | /** 57 | * 6.确认按钮的点击事件 58 | */ 59 | - (void)selectedOk; 60 | 61 | /** 62 | * 7.显示 63 | */ 64 | - (void)show; 65 | 66 | /** 67 | * 8.移除 68 | */ 69 | - (void)remove; 70 | 71 | @end 72 | NS_ASSUME_NONNULL_END 73 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // STPickerViewTest 4 | // 5 | // Created by ST on 16/11/3. 6 | // Copyright © 2016年 ST. 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 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # STPickerView 2 | 3 | ![License MIT](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000) 4 | ![Pod version](https://img.shields.io/cocoapods/v/STPickerView.svg?style=flat) 5 | [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 6 | [![Platform info](https://img.shields.io/cocoapods/p/STPickerView.svg?style=flat)](http://cocoadocs.org/docsets/STPickerView) 7 | 8 | 一个多功能的选择器,有城市选择,日期选择和单数组源自定的功能,方便大家的使用,低耦合,易扩展。如果大家喜欢请给个星星,我将不断提供更好的代码。 9 | 10 | ---------------------------- 11 | 12 | ## 一、使用 13 | 14 | 1. 使用Pod方式 `pod 'STPickerView', '2.4'` 15 | 2. 使用Carthage方式 `github 'STShenzhaoliang/STPickerView' '2.4'` 16 | 3. Swift使用Pod方式,Podfile文件添加 17 | 18 | ```ruby 19 | use_frameworks! 20 | ``` 21 | 22 | ## 二、效果图展示 23 | ### 1.城市选择器效果图 24 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STPickerView/show0.gif) 25 | ### 2.日期选择器效果图 26 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STPickerView/show2.gif) 27 | ### 3.单数组效果图 28 | #### 根据单数据的模式,可以扩展多数据的模式 29 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STPickerView/show1.gif) 30 | 31 | ### 4.中间的显示模式 32 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STPickerView/show4.png) 33 | 34 | ## 三、接口 35 | ### 1.显示模式枚举 36 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STPickerView/picture0.jpg) 37 | ### 2.视图接口 38 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STPickerView/picture1.jpg) 39 | ### 3.方法接口 40 | ![image](https://github.com/STShenZhaoliang/STImage/blob/master/STPickerView/picture2.jpg) 41 | 42 | ## 四、使用举例 43 | 44 | ```objective-c 45 | 46 | STPickerSingle *pickerSingle = [[STPickerSingle alloc]init]; 47 | [pickerSingle setArrayData:arrayData]; 48 | [pickerSingle setTitle:@"请选择价格"]; 49 | [pickerSingle setTitleUnit:@"人民币"]; 50 | [pickerSingle setContentMode:STPickerContentModeCenter]; 51 | [pickerSingle setDelegate:self]; 52 | [pickerSingle show]; 53 | 54 | ``` 55 | 56 | ## 五、版本信息 57 | ## 2.4 58 | 1. 修复iphonePlus的显示问题 59 | 60 | ### 2.3 61 | 1. 地区选择器添加记录之前地区接口 62 | 63 | ### 2.2 64 | 1. 修改日期选择的问题 65 | 66 | ### 2.1 67 | 1. 支持横竖屏 68 | 2. 修改日期选择的问题 69 | 3. 优化界面 70 | 71 | ### 2.0 72 | 1. 添加Carthage的支持 73 | 74 | ### 1.0.0 75 | 1. 支持城市,时间,单项选择 76 | 2. 支持中间和下方显示 77 | 78 | 79 | -------------------------------------------------------------------------------- /STPickerView.xcodeproj/xcshareddata/xcschemes/STPickerView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/UIView+STPicker.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+STFrame.h 3 | // STPickerView 4 | // 5 | // Created by ST on 16/10/31. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import "UIView+STPicker.h" 10 | 11 | @implementation UIView (STPicker) 12 | 13 | - (void)setSt_x:(CGFloat)st_x 14 | { 15 | CGRect frame = self.frame; 16 | frame.origin.x = st_x; 17 | self.frame = frame; 18 | } 19 | 20 | - (void)setSt_y:(CGFloat)st_y 21 | { 22 | CGRect frame = self.frame; 23 | frame.origin.y = st_y; 24 | self.frame = frame; 25 | } 26 | 27 | - (CGFloat)st_x 28 | { 29 | return self.frame.origin.x; 30 | } 31 | 32 | - (CGFloat)st_y 33 | { 34 | return self.frame.origin.y; 35 | } 36 | 37 | - (void)setSt_width:(CGFloat)width 38 | { 39 | CGRect frame = self.frame; 40 | frame.size.width = width; 41 | self.frame = frame; 42 | } 43 | 44 | - (void)setSt_height:(CGFloat)height 45 | { 46 | CGRect frame = self.frame; 47 | frame.size.height = height; 48 | self.frame = frame; 49 | } 50 | 51 | - (CGFloat)st_height 52 | { 53 | return self.frame.size.height; 54 | } 55 | 56 | - (CGFloat)st_width 57 | { 58 | return self.frame.size.width; 59 | } 60 | 61 | - (void)setSt_centerX:(CGFloat)centerX 62 | { 63 | CGPoint center = self.center; 64 | center.x = centerX; 65 | self.center = center; 66 | } 67 | 68 | - (CGFloat)st_centerX 69 | { 70 | return self.center.x; 71 | } 72 | 73 | - (void)setSt_centerY:(CGFloat)centerY 74 | { 75 | CGPoint center = self.center; 76 | center.y = centerY; 77 | self.center = center; 78 | } 79 | 80 | - (CGFloat)st_centerY 81 | { 82 | return self.center.y; 83 | } 84 | 85 | - (void)setSt_size:(CGSize)size 86 | { 87 | CGRect frame = self.frame; 88 | frame.size = size; 89 | self.frame = frame; 90 | } 91 | 92 | - (CGSize)st_size 93 | { 94 | return self.frame.size; 95 | } 96 | 97 | - (void)setSt_origin:(CGPoint)origin 98 | { 99 | CGRect frame = self.frame; 100 | frame.origin = origin; 101 | self.frame = frame; 102 | } 103 | 104 | - (CGPoint)st_origin 105 | { 106 | return self.frame.origin; 107 | } 108 | 109 | - (CGFloat)st_left { 110 | return self.frame.origin.x; 111 | } 112 | 113 | - (void)setSt_left:(CGFloat)x { 114 | CGRect frame = self.frame; 115 | frame.origin.x = x; 116 | self.frame = frame; 117 | } 118 | 119 | - (CGFloat)st_top { 120 | return self.frame.origin.y; 121 | } 122 | 123 | - (void)setSt_top:(CGFloat)y { 124 | CGRect frame = self.frame; 125 | frame.origin.y = y; 126 | self.frame = frame; 127 | } 128 | 129 | - (CGFloat)st_right { 130 | return self.frame.origin.x + self.frame.size.width; 131 | } 132 | 133 | - (void)setSt_right:(CGFloat)right { 134 | CGRect frame = self.frame; 135 | frame.origin.x = right - frame.size.width; 136 | self.frame = frame; 137 | } 138 | 139 | - (CGFloat)st_bottom { 140 | return self.frame.origin.y + self.frame.size.height; 141 | } 142 | 143 | - (void)setSt_bottom:(CGFloat)bottom { 144 | CGRect frame = self.frame; 145 | frame.origin.y = bottom - frame.size.height; 146 | self.frame = frame; 147 | } 148 | 149 | - (void)addBorderColor:(UIColor *)color{ 150 | [self.layer setBorderColor:color.CGColor]; 151 | [self.layer setBorderWidth:0.5]; 152 | [self.layer setCornerRadius:4]; 153 | } 154 | @end 155 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // STPickerViewTest 4 | // 5 | // Created by ST on 16/11/3. 6 | // Copyright © 2016年 ST. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "STPickerView.h" 11 | #import "STPickerSingle.h" 12 | #import "STPickerDate.h" 13 | #import "STPickerArea.h" 14 | 15 | 16 | @interface ViewController () 17 | @property (weak, nonatomic) IBOutlet UITextField *textArea; 18 | @property (weak, nonatomic) IBOutlet UITextField *textSingle; 19 | @property (weak, nonatomic) IBOutlet UITextField *textDate; 20 | @end 21 | 22 | @implementation ViewController 23 | 24 | #pragma mark - --- lift cycle 生命周期 --- 25 | - (void)viewDidLoad 26 | { 27 | [super viewDidLoad]; 28 | self.textArea.delegate = self; 29 | self.textSingle.delegate = self; 30 | self.textDate.delegate = self; 31 | } 32 | 33 | 34 | #pragma mark - --- delegate 视图委托 --- 35 | 36 | - (void)textFieldDidBeginEditing:(UITextField *)textField 37 | { 38 | if (textField == self.textArea) { 39 | [self.textArea resignFirstResponder]; 40 | 41 | 42 | STPickerArea *pickerArea = [[STPickerArea alloc]init]; 43 | [pickerArea setDelegate:self]; 44 | [pickerArea setSaveHistory:YES]; 45 | [pickerArea setContentMode:STPickerContentModeCenter]; 46 | [pickerArea show]; 47 | 48 | } 49 | 50 | if (textField == self.textSingle) { 51 | [self.textSingle resignFirstResponder]; 52 | 53 | NSMutableArray *arrayData = [NSMutableArray array]; 54 | for (int i = 1; i < 1000; i++) { 55 | NSString *string = [NSString stringWithFormat:@"%d", i]; 56 | [arrayData addObject:string]; 57 | } 58 | 59 | STPickerSingle *pickerSingle = [[STPickerSingle alloc]init]; 60 | [pickerSingle setArrayData:arrayData]; 61 | [pickerSingle setTitle:@"请选择价格"]; 62 | [pickerSingle setTitleUnit:@"人民币"]; 63 | [pickerSingle setContentMode:STPickerContentModeCenter]; 64 | [pickerSingle setDelegate:self]; 65 | [pickerSingle show]; 66 | } 67 | 68 | 69 | if (textField == self.textDate) { 70 | [self.textDate resignFirstResponder]; 71 | 72 | STPickerDate *pickerDate = [[STPickerDate alloc]init]; 73 | [pickerDate setYearLeast:2000]; 74 | [pickerDate setYearSum:50]; 75 | [pickerDate setDelegate:self]; 76 | [pickerDate show]; 77 | } 78 | } 79 | 80 | - (void)pickerArea:(STPickerArea *)pickerArea province:(NSString *)province city:(NSString *)city area:(NSString *)area 81 | { 82 | NSString *text = [NSString stringWithFormat:@"%@ %@ %@", province, city, area]; 83 | self.textArea.text = text; 84 | } 85 | 86 | - (void)pickerSingle:(STPickerSingle *)pickerSingle selectedTitle:(NSString *)selectedTitle 87 | { 88 | NSString *text = [NSString stringWithFormat:@"%@ 人民币", selectedTitle]; 89 | self.textSingle.text = text; 90 | } 91 | 92 | - (void)pickerDate:(STPickerDate *)pickerDate year:(NSInteger)year month:(NSInteger)month day:(NSInteger)day 93 | { 94 | NSString *text = [NSString stringWithFormat:@"%zd年%zd月%zd日", year, month, day]; 95 | self.textDate.text = text; 96 | } 97 | #pragma mark - --- event response 事件相应 --- 98 | 99 | #pragma mark - --- private methods 私有方法 --- 100 | 101 | #pragma mark - --- getters and setters 属性 --- 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerSingle.m: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerSingle.m 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/16. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import "STPickerSingle.h" 10 | 11 | @interface STPickerSingle() 12 | /** 1.选中的字符串 */ 13 | @property (nonatomic, strong, nullable)NSString *selectedTitle; 14 | 15 | @end 16 | 17 | @implementation STPickerSingle 18 | 19 | #pragma mark - --- init 视图初始化 --- 20 | - (void)setupUI 21 | { 22 | [super setupUI]; 23 | 24 | _titleUnit = @""; 25 | _arrayData = @[].mutableCopy; 26 | _heightPickerComponent = 44; 27 | _widthPickerComponent = 32; 28 | 29 | [self.pickerView setDelegate:self]; 30 | [self.pickerView setDataSource:self]; 31 | } 32 | 33 | #pragma mark - --- delegate 视图委托 --- 34 | 35 | - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView 36 | { 37 | return 3; 38 | } 39 | 40 | - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component 41 | { 42 | if (component == 0) { 43 | return 1; 44 | }else if (component == 1){ 45 | return self.arrayData.count; 46 | }else { 47 | return 1; 48 | } 49 | } 50 | 51 | - (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component 52 | { 53 | return self.heightPickerComponent; 54 | } 55 | 56 | - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component 57 | { 58 | 59 | if (component == 0) { 60 | return (self.st_width-self.widthPickerComponent)/2; 61 | }else if (component == 1){ 62 | return self.widthPickerComponent; 63 | }else { 64 | return (self.st_width-self.widthPickerComponent)/2; 65 | } 66 | } 67 | 68 | - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 69 | { 70 | self.selectedTitle = self.arrayData[row]; 71 | } 72 | 73 | - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view 74 | { 75 | //设置分割线的颜色 76 | [pickerView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 77 | if (obj.frame.size.height <=1) { 78 | obj.backgroundColor = self.borderButtonColor; 79 | } 80 | }]; 81 | 82 | if (component == 0) { 83 | return nil; 84 | }else if (component == 1){ 85 | UILabel *label = [[UILabel alloc]init]; 86 | [label setText:self.arrayData[row]]; 87 | [label setTextAlignment:NSTextAlignmentCenter]; 88 | return label; 89 | }else { 90 | UILabel *label = [[UILabel alloc]init]; 91 | [label setText:self.titleUnit]; 92 | [label setTextAlignment:NSTextAlignmentLeft]; 93 | return label; 94 | } 95 | } 96 | #pragma mark - --- event response 事件相应 --- 97 | 98 | - (void)selectedOk 99 | { 100 | if ([self.delegate respondsToSelector:@selector(pickerSingle:selectedTitle:)]) { 101 | [self.delegate pickerSingle:self selectedTitle:self.selectedTitle]; 102 | } 103 | 104 | [super selectedOk]; 105 | } 106 | 107 | #pragma mark - --- private methods 私有方法 --- 108 | 109 | #pragma mark - --- setters 属性 --- 110 | 111 | - (void)setArrayData:(NSMutableArray *)arrayData 112 | { 113 | _arrayData = arrayData; 114 | _selectedTitle = arrayData.firstObject; 115 | [self.pickerView reloadAllComponents]; 116 | } 117 | 118 | - (void)setTitleUnit:(NSString *)titleUnit 119 | { 120 | _titleUnit = titleUnit; 121 | [self.pickerView reloadAllComponents]; 122 | } 123 | 124 | #pragma mark - --- getters 属性 --- 125 | @end 126 | 127 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerDate.m: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerDate.m 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/16. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import "STPickerDate.h" 10 | #import "NSCalendar+STPicker.h" 11 | 12 | typedef NS_OPTIONS(NSUInteger, STCalendarUnit) { 13 | STCalendarUnitYear = (1UL << 0), 14 | STCalendarUnitMonth = (1UL << 1), 15 | STCalendarUnitDay = (1UL << 2), 16 | STCalendarUnitHour = (1UL << 3), 17 | STCalendarUnitMinute= (1UL << 4), 18 | }; 19 | 20 | @interface STPickerDate() 21 | /** 1.年 */ 22 | @property (nonatomic, assign)NSInteger year; 23 | /** 2.月 */ 24 | @property (nonatomic, assign)NSInteger month; 25 | /** 3.日 */ 26 | @property (nonatomic, assign)NSInteger day; 27 | 28 | @end 29 | 30 | @implementation STPickerDate 31 | 32 | #pragma mark - --- init 视图初始化 --- 33 | 34 | - (void)setupUI { 35 | 36 | self.title = @"请选择日期"; 37 | 38 | _yearLeast = 1900; 39 | _yearSum = 200; 40 | _heightPickerComponent = 28; 41 | // self.calendarUnit = STCalendarUnitYear | STCalendarUnitMonth | STCalendarUnitDay; 42 | 43 | _year = [NSCalendar currentYear]; 44 | _month = [NSCalendar currentMonth]; 45 | _day = [NSCalendar currentDay]; 46 | 47 | [self.pickerView setDelegate:self]; 48 | [self.pickerView setDataSource:self]; 49 | } 50 | 51 | #pragma mark - --- delegate 视图委托 --- 52 | 53 | - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView 54 | { 55 | return 3; 56 | } 57 | 58 | - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component 59 | { 60 | switch (component) { 61 | case 0: 62 | return self.yearSum; 63 | break; 64 | case 1: 65 | return 12; 66 | break; 67 | default: 68 | return [NSCalendar getDaysWithYear:self.year month:self.month]; 69 | break; 70 | } 71 | } 72 | 73 | - (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component 74 | { 75 | return self.heightPickerComponent; 76 | } 77 | 78 | - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 79 | { 80 | switch (component) { 81 | case 0:{ 82 | self.year = row + self.yearLeast; 83 | [pickerView reloadComponent:2]; 84 | }break; 85 | case 1:{ 86 | self.month = row + 1; 87 | [pickerView reloadComponent:2]; 88 | }break; 89 | case 2:{ 90 | }break; 91 | } 92 | } 93 | 94 | - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view 95 | { 96 | 97 | //设置分割线的颜色 98 | [pickerView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 99 | if (obj.frame.size.height <=1) { 100 | obj.backgroundColor = self.borderButtonColor; 101 | } 102 | }]; 103 | 104 | NSString *text; 105 | if (component == 0) { 106 | text = [NSString stringWithFormat:@"%zd", row + self.yearLeast]; 107 | }else if (component == 1){ 108 | text = [NSString stringWithFormat:@"%zd", row + 1]; 109 | }else{ 110 | text = [NSString stringWithFormat:@"%zd", row + 1]; 111 | } 112 | 113 | UILabel *label = [[UILabel alloc]init]; 114 | [label setTextAlignment:NSTextAlignmentCenter]; 115 | [label setFont:[UIFont systemFontOfSize:17]]; 116 | [label setText:text]; 117 | return label; 118 | } 119 | #pragma mark - --- event response 事件相应 --- 120 | 121 | - (void)selectedOk 122 | { 123 | if ([self.delegate respondsToSelector:@selector(pickerDate:year:month:day:)]) { 124 | NSInteger day = [self.pickerView selectedRowInComponent:2] + 1; 125 | [self.delegate pickerDate:self year:self.year month:self.month day:day]; 126 | } 127 | 128 | [super selectedOk]; 129 | } 130 | 131 | #pragma mark - --- private methods 私有方法 --- 132 | 133 | #pragma mark - --- setters 属性 --- 134 | 135 | - (void)setYearLeast:(NSInteger)yearLeast 136 | { 137 | if (yearLeast<=0) { 138 | return; 139 | } 140 | 141 | _yearLeast = yearLeast; 142 | [self.pickerView selectRow:(_year - _yearLeast) inComponent:0 animated:NO]; 143 | [self.pickerView selectRow:(_month - 1) inComponent:1 animated:NO]; 144 | [self.pickerView selectRow:(_day - 1) inComponent:2 animated:NO]; 145 | [self.pickerView reloadAllComponents]; 146 | } 147 | 148 | - (void)setYearSum:(NSInteger)yearSum{ 149 | if (yearSum<=0) { 150 | return; 151 | } 152 | 153 | _yearSum = yearSum; 154 | [self.pickerView reloadAllComponents]; 155 | } 156 | 157 | #pragma mark - --- getters 属性 --- 158 | 159 | 160 | @end 161 | 162 | 163 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo/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 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/NSCalendar+STPicker.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSCalendar+ST.m 3 | // STCalendarDemo 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STCalendar on 15/12/17. 6 | // Copyright © 2015年 ST. All rights reserved. 7 | // 8 | 9 | #import "NSCalendar+STPicker.h" 10 | 11 | @implementation NSCalendar (STPicker) 12 | 13 | + (NSDateComponents *)currentDateComponents 14 | { 15 | NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 16 | NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday; 17 | return [calendar components:unitFlags fromDate:[NSDate date]]; 18 | } 19 | 20 | + (NSInteger)currentMonth 21 | { 22 | return [NSCalendar currentDateComponents].month; 23 | } 24 | 25 | + (NSInteger)currentYear 26 | { 27 | return [NSCalendar currentDateComponents].year; 28 | } 29 | 30 | + (NSInteger)currentDay 31 | { 32 | return [NSCalendar currentDateComponents].day; 33 | } 34 | 35 | + (NSInteger)currnentWeekday 36 | { 37 | return [NSCalendar currentDateComponents].weekday; 38 | } 39 | 40 | + (NSInteger)getDaysWithYear:(NSInteger)year 41 | month:(NSInteger)month 42 | { 43 | switch (month) { 44 | case 1: 45 | return 31; 46 | break; 47 | case 2: 48 | if (year%400==0 || (year%100!=0 && year%4 == 0)) { 49 | return 29; 50 | }else{ 51 | return 28; 52 | } 53 | break; 54 | case 3: 55 | return 31; 56 | break; 57 | case 4: 58 | return 30; 59 | break; 60 | case 5: 61 | return 31; 62 | break; 63 | case 6: 64 | return 30; 65 | break; 66 | case 7: 67 | return 31; 68 | break; 69 | case 8: 70 | return 31; 71 | break; 72 | case 9: 73 | return 30; 74 | break; 75 | case 10: 76 | return 31; 77 | break; 78 | case 11: 79 | return 30; 80 | break; 81 | case 12: 82 | return 31; 83 | break; 84 | default: 85 | return 0; 86 | break; 87 | } 88 | } 89 | 90 | + (NSInteger)getFirstWeekdayWithYear:(NSInteger)year 91 | month:(NSInteger)month 92 | { 93 | NSString *stringDate = [NSString stringWithFormat:@"%ld-%ld-01", (long)year, (long)month]; 94 | NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; 95 | [formatter setDateFormat:@"yy-MM-dd"]; 96 | NSDate *date = [formatter dateFromString:stringDate]; 97 | 98 | NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 99 | NSDateComponents *components = [gregorian components:(NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitWeekday) fromDate:date]; 100 | return [components weekday]; 101 | } 102 | 103 | + (NSComparisonResult)compareWithComponentsOne:(NSDateComponents *)componentsOne 104 | componentsTwo:(NSDateComponents *)componentsTwo 105 | { 106 | if (componentsOne.year == componentsTwo.year && 107 | componentsOne.month == componentsTwo.month && 108 | componentsOne.day == componentsTwo.day) { 109 | return NSOrderedSame; 110 | }else if (componentsOne.year < componentsTwo.year || 111 | (componentsOne.year == componentsTwo.year && componentsOne.month < componentsTwo.month) || 112 | (componentsOne.year == componentsTwo.year && componentsOne.month == componentsTwo.month && componentsOne.day < componentsTwo.day)) { 113 | return NSOrderedAscending; 114 | }else { 115 | return NSOrderedDescending; 116 | } 117 | } 118 | 119 | + (NSMutableArray *)arrayComponentsWithComponentsOne:(NSDateComponents *)componentsOne 120 | componentsTwo:(NSDateComponents *)componentsTwo 121 | { 122 | NSMutableArray *arrayComponents = [NSMutableArray array]; 123 | 124 | NSString *stringOne = [NSString stringWithFormat:@"%zd-%zd-%zd", componentsOne.year, 125 | componentsOne.month, 126 | componentsOne.day]; 127 | NSString *stringTwo = [NSString stringWithFormat:@"%zd-%zd-%zd", componentsTwo.year, 128 | componentsTwo.month, 129 | componentsTwo.day]; 130 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; 131 | [dateFormatter setDateFormat:@"yy-MM-dd"]; 132 | 133 | NSDate *dateFromString = [dateFormatter dateFromString:stringOne]; 134 | NSDate *dateToString = [dateFormatter dateFromString:stringTwo]; 135 | int timediff = [dateToString timeIntervalSince1970]-[dateFromString timeIntervalSince1970]; 136 | 137 | NSTimeInterval timeInterval = [dateFromString timeIntervalSinceDate:dateFromString]; 138 | 139 | for (int i = 0; i <= timediff; i+=86400) { 140 | timeInterval = i; 141 | NSDate *date = [dateFromString dateByAddingTimeInterval:timeInterval]; 142 | 143 | NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 144 | NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday; 145 | [arrayComponents addObject:[calendar components:unitFlags fromDate:date]]; 146 | } 147 | return arrayComponents; 148 | } 149 | 150 | + (NSDateComponents *)dateComponentsWithString:(NSString *)String 151 | { 152 | NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; 153 | [formatter setDateFormat:@"yy-MM-dd"]; 154 | NSDate *date = [formatter dateFromString:String]; 155 | 156 | NSCalendar *calendar = [NSCalendar currentCalendar]; 157 | NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday; 158 | return [calendar components:unitFlags fromDate:date]; 159 | } 160 | @end 161 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerArea.m: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerArea.m 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/15. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import "STPickerArea.h" 10 | 11 | @interface STPickerArea() 12 | 13 | /** 1.数据源数组 */ 14 | @property (nonatomic, strong, nullable)NSArray *arrayRoot; 15 | /** 2.当前省数组 */ 16 | @property (nonatomic, strong, nullable)NSMutableArray *arrayProvince; 17 | /** 3.当前城市数组 */ 18 | @property (nonatomic, strong, nullable)NSMutableArray *arrayCity; 19 | /** 4.当前地区数组 */ 20 | @property (nonatomic, strong, nullable)NSMutableArray *arrayArea; 21 | /** 5.当前选中数组 */ 22 | @property (nonatomic, strong, nullable)NSMutableArray *arraySelected; 23 | 24 | /** 6.省份 */ 25 | @property (nonatomic, strong, nullable)NSString *province; 26 | /** 7.城市 */ 27 | @property (nonatomic, strong, nullable)NSString *city; 28 | /** 8.地区 */ 29 | @property (nonatomic, strong, nullable)NSString *area; 30 | 31 | @end 32 | 33 | @implementation STPickerArea 34 | 35 | #pragma mark - --- init 视图初始化 --- 36 | 37 | - (void)setupUI 38 | { 39 | // 1.获取数据 40 | [self.arrayRoot enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) { 41 | [self.arrayProvince addObject:obj[@"state"]]; 42 | }]; 43 | 44 | NSMutableArray *citys = [NSMutableArray arrayWithArray:[self.arrayRoot firstObject][@"cities"]]; 45 | [citys enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) { 46 | [self.arrayCity addObject:obj[@"city"]]; 47 | }]; 48 | 49 | self.arrayArea = [citys firstObject][@"area"]; 50 | 51 | self.province = self.arrayProvince[0]; 52 | self.city = self.arrayCity[0]; 53 | if (self.arrayArea.count != 0) { 54 | self.area = self.arrayArea[0]; 55 | }else{ 56 | self.area = @""; 57 | } 58 | self.saveHistory = NO; 59 | 60 | // 2.设置视图的默认属性 61 | _heightPickerComponent = 32; 62 | [self setTitle:@"请选择城市地区"]; 63 | [self.pickerView setDelegate:self]; 64 | [self.pickerView setDataSource:self]; 65 | 66 | } 67 | #pragma mark - --- delegate 视图委托 --- 68 | 69 | - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView 70 | { 71 | return 3; 72 | } 73 | 74 | - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component 75 | { 76 | if (component == 0) { 77 | return self.arrayProvince.count; 78 | }else if (component == 1) { 79 | return self.arrayCity.count; 80 | }else{ 81 | return self.arrayArea.count; 82 | } 83 | } 84 | 85 | - (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component 86 | { 87 | return self.heightPickerComponent; 88 | } 89 | 90 | - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 91 | { 92 | if (component == 0) { 93 | self.arraySelected = self.arrayRoot[row][@"cities"]; 94 | 95 | [self.arrayCity removeAllObjects]; 96 | [self.arraySelected enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) { 97 | [self.arrayCity addObject:obj[@"city"]]; 98 | }]; 99 | 100 | self.arrayArea = [NSMutableArray arrayWithArray:[self.arraySelected firstObject][@"areas"]]; 101 | 102 | [pickerView reloadComponent:1]; 103 | [pickerView reloadComponent:2]; 104 | [pickerView selectRow:0 inComponent:1 animated:YES]; 105 | [pickerView selectRow:0 inComponent:2 animated:YES]; 106 | 107 | }else if (component == 1) { 108 | if (self.arraySelected.count == 0) { 109 | self.arraySelected = [self.arrayRoot firstObject][@"cities"]; 110 | } 111 | 112 | self.arrayArea = [NSMutableArray arrayWithArray:[self.arraySelected objectAtIndex:row][@"areas"]]; 113 | 114 | [pickerView reloadComponent:2]; 115 | [pickerView selectRow:0 inComponent:2 animated:YES]; 116 | 117 | }else{ 118 | } 119 | 120 | [self reloadData]; 121 | } 122 | 123 | - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view 124 | { 125 | 126 | //设置分割线的颜色 127 | [pickerView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 128 | if (obj.frame.size.height <=1) { 129 | obj.backgroundColor = self.borderButtonColor; 130 | } 131 | }]; 132 | 133 | 134 | NSString *text; 135 | if (component == 0) { 136 | text = self.arrayProvince[row]; 137 | }else if (component == 1){ 138 | text = self.arrayCity[row]; 139 | }else{ 140 | if (self.arrayArea.count > 0) { 141 | text = self.arrayArea[row]; 142 | }else{ 143 | text = @""; 144 | } 145 | } 146 | 147 | UILabel *label = [[UILabel alloc]init]; 148 | [label setTextAlignment:NSTextAlignmentCenter]; 149 | [label setFont:[UIFont systemFontOfSize:17]]; 150 | [label setText:text]; 151 | return label; 152 | } 153 | #pragma mark - --- event response 事件相应 --- 154 | 155 | - (void)selectedOk 156 | { 157 | 158 | if (self.isSaveHistory) { 159 | NSDictionary *dicHistory = @{@"province":self.province, @"city":self.city, @"area":self.area}; 160 | [[NSUserDefaults standardUserDefaults] setObject:dicHistory forKey:@"STPickerArea"]; 161 | }else { 162 | [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"STPickerArea"]; 163 | } 164 | 165 | if ([self.delegate respondsToSelector:@selector(pickerArea:province:city:area:)]) { 166 | [self.delegate pickerArea:self province:self.province city:self.city area:self.area]; 167 | } 168 | [super selectedOk]; 169 | } 170 | 171 | #pragma mark - --- private methods 私有方法 --- 172 | 173 | - (void)reloadData 174 | { 175 | NSInteger index0 = [self.pickerView selectedRowInComponent:0]; 176 | NSInteger index1 = [self.pickerView selectedRowInComponent:1]; 177 | NSInteger index2 = [self.pickerView selectedRowInComponent:2]; 178 | self.province = self.arrayProvince[index0]; 179 | self.city = self.arrayCity[index1]; 180 | if (self.arrayArea.count != 0) { 181 | self.area = self.arrayArea[index2]; 182 | }else{ 183 | self.area = @""; 184 | } 185 | 186 | NSString *title = [NSString stringWithFormat:@"%@ %@ %@", self.province, self.city, self.area]; 187 | [self setTitle:title]; 188 | 189 | } 190 | 191 | #pragma mark - --- setters 属性 --- 192 | 193 | - (void)setSaveHistory:(BOOL)saveHistory{ 194 | _saveHistory = saveHistory; 195 | 196 | if (saveHistory) { 197 | NSDictionary *dicHistory = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"STPickerArea"]; 198 | __block NSUInteger numberProvince = 0; 199 | __block NSUInteger numberCity = 0; 200 | __block NSUInteger numberArea = 0; 201 | 202 | if (dicHistory) { 203 | NSString *province = [NSString stringWithFormat:@"%@", dicHistory[@"province"]]; 204 | NSString *city = [NSString stringWithFormat:@"%@", dicHistory[@"city"]]; 205 | NSString *area = [NSString stringWithFormat:@"%@", dicHistory[@"area"]]; 206 | 207 | [self.arrayProvince enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 208 | if ([obj isEqualToString:province]) { 209 | numberProvince = idx; 210 | } 211 | }]; 212 | 213 | self.arraySelected = self.arrayRoot[numberProvince][@"cities"]; 214 | 215 | [self.arrayCity removeAllObjects]; 216 | [self.arraySelected enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) { 217 | [self.arrayCity addObject:obj[@"city"]]; 218 | }]; 219 | 220 | [self.arrayCity enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 221 | if ([obj isEqualToString:city]) { 222 | numberCity = idx; 223 | } 224 | }]; 225 | 226 | 227 | if (self.arraySelected.count == 0) { 228 | self.arraySelected = [self.arrayRoot firstObject][@"cities"]; 229 | } 230 | 231 | self.arrayArea = [NSMutableArray arrayWithArray:[self.arraySelected objectAtIndex:numberCity][@"areas"]]; 232 | 233 | [self.arrayArea enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 234 | if ([obj isEqualToString:area]) { 235 | numberArea = idx; 236 | } 237 | }]; 238 | 239 | [self.pickerView selectRow:numberProvince inComponent:0 animated:NO]; 240 | [self.pickerView selectRow:numberCity inComponent:1 animated:NO]; 241 | [self.pickerView selectRow:numberArea inComponent:2 animated:NO]; 242 | [self.pickerView reloadAllComponents]; 243 | [self reloadData]; 244 | } 245 | } 246 | } 247 | 248 | #pragma mark - --- getters 属性 --- 249 | 250 | - (NSArray *)arrayRoot 251 | { 252 | if (!_arrayRoot) { 253 | NSString *path = [[NSBundle bundleForClass:[STPickerView class]] pathForResource:@"area" ofType:@"plist"]; 254 | _arrayRoot = [[NSArray alloc]initWithContentsOfFile:path]; 255 | } 256 | return _arrayRoot; 257 | } 258 | 259 | - (NSMutableArray *)arrayProvince 260 | { 261 | if (!_arrayProvince) { 262 | _arrayProvince = @[].mutableCopy; 263 | } 264 | return _arrayProvince; 265 | } 266 | 267 | - (NSMutableArray *)arrayCity 268 | { 269 | if (!_arrayCity) { 270 | _arrayCity = @[].mutableCopy; 271 | } 272 | return _arrayCity; 273 | } 274 | 275 | - (NSMutableArray *)arrayArea 276 | { 277 | if (!_arrayArea) { 278 | _arrayArea = @[].mutableCopy; 279 | } 280 | return _arrayArea; 281 | } 282 | 283 | - (NSMutableArray *)arraySelected 284 | { 285 | if (!_arraySelected) { 286 | _arraySelected = @[].mutableCopy; 287 | } 288 | return _arraySelected; 289 | } 290 | 291 | @end 292 | 293 | 294 | -------------------------------------------------------------------------------- /STPickerView/STPickerView/STPickerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // STPickerView.m 3 | // STPickerView 4 | // 5 | // Created by https://github.com/STShenZhaoliang/STPickerView on 16/2/17. 6 | // Copyright © 2016年 shentian. All rights reserved. 7 | // 8 | 9 | #import "STPickerView.h" 10 | 11 | #define STScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds) 12 | #define STScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds) 13 | 14 | @interface STPickerView() 15 | @property (nonatomic, assign, getter=isIphonePlus)BOOL iphonePlus; 16 | @end 17 | 18 | @implementation STPickerView 19 | 20 | #pragma mark - --- init 视图初始化 --- 21 | - (instancetype)init 22 | { 23 | self = [super init]; 24 | if (self) { 25 | [self setupDefault]; 26 | [self setupUI]; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)setupDefault 32 | { 33 | // 1.设置数据的默认值 34 | _title = nil; 35 | _font = [UIFont systemFontOfSize:17]; 36 | _titleColor = [UIColor blackColor]; 37 | _borderButtonColor = [UIColor colorWithRed:205.0/255 green:205.0/255 blue:205.0/255 alpha:1] ; 38 | _heightPicker = 240; 39 | _contentMode = STPickerContentModeBottom; 40 | 41 | // 2.设置自身的属性 42 | self.bounds = [UIScreen mainScreen].bounds; 43 | self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:102.0/255]; 44 | self.layer.opacity = 0.0; 45 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 46 | [self addTarget:self action:@selector(remove) forControlEvents:UIControlEventTouchUpInside]; 47 | // 3.添加子视图 48 | [self addSubview:self.contentView]; 49 | [self.contentView addSubview:self.lineView]; 50 | [self.contentView addSubview:self.pickerView]; 51 | [self.contentView addSubview:self.buttonLeft]; 52 | [self.contentView addSubview:self.buttonRight]; 53 | [self.contentView addSubview:self.labelTitle]; 54 | [self.contentView addSubview:self.lineViewDown]; 55 | } 56 | 57 | - (void)setupUI 58 | {} 59 | 60 | - (void)layoutSubviews 61 | { 62 | [super layoutSubviews]; 63 | 64 | if (self.contentMode == STPickerContentModeBottom) { 65 | }else { 66 | self.lineViewDown.st_bottom = self.contentView.st_height - STControlSystemHeight; 67 | self.buttonLeft.st_y = self.lineViewDown.st_bottom + STMarginSmall; 68 | self.buttonRight.st_y = self.lineViewDown.st_bottom + STMarginSmall; 69 | } 70 | } 71 | 72 | #pragma mark - --- delegate 视图委托 --- 73 | 74 | #pragma mark - --- event response 事件相应 --- 75 | 76 | - (void)selectedOk 77 | { 78 | [self remove]; 79 | } 80 | 81 | - (void)selectedCancel 82 | { 83 | [self remove]; 84 | } 85 | 86 | #pragma mark - --- private methods 私有方法 --- 87 | 88 | 89 | - (void)show 90 | { 91 | [[UIApplication sharedApplication].keyWindow addSubview:self]; 92 | [self setCenter:[UIApplication sharedApplication].keyWindow.center]; 93 | [[UIApplication sharedApplication].keyWindow bringSubviewToFront:self]; 94 | 95 | if (self.contentMode == STPickerContentModeBottom) { 96 | CGRect frameContent = self.contentView.frame; 97 | if (self.isIphonePlus) { 98 | frameContent.origin.y = STScreenHeight - self.contentView.st_height + 16; 99 | }else { 100 | frameContent.origin.y = STScreenHeight - self.contentView.st_height; 101 | } 102 | [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 103 | [self.layer setOpacity:1.0]; 104 | self.contentView.frame = frameContent; 105 | } completion:^(BOOL finished) { 106 | }]; 107 | }else { 108 | CGRect frameContent = self.contentView.frame; 109 | if (self.isIphonePlus) { 110 | frameContent.origin.y = (STScreenHeight - self.contentView.st_height + 16)/2; 111 | }else { 112 | frameContent.origin.y = (STScreenHeight - self.contentView.st_height)/2; 113 | } 114 | [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 115 | [self.layer setOpacity:1.0]; 116 | self.contentView.frame = frameContent; 117 | self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 118 | } completion:^(BOOL finished) { 119 | }]; 120 | } 121 | } 122 | 123 | - (void)remove 124 | { 125 | if (self.contentMode == STPickerContentModeBottom) { 126 | CGRect frameContent = self.contentView.frame; 127 | frameContent.origin.y += self.contentView.st_height; 128 | [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 129 | [self.layer setOpacity:0.0]; 130 | self.contentView.frame = frameContent; 131 | } completion:^(BOOL finished) { 132 | [self removeFromSuperview]; 133 | }]; 134 | }else { 135 | CGRect frameContent = self.contentView.frame; 136 | frameContent.origin.y += (STScreenHeight+self.contentView.st_height)/2; 137 | [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 138 | [self.layer setOpacity:0.0]; 139 | self.contentView.frame = frameContent; 140 | } completion:^(BOOL finished) { 141 | [self removeFromSuperview]; 142 | }]; 143 | } 144 | } 145 | 146 | #pragma mark - --- setters 属性 --- 147 | 148 | - (void)setTitle:(NSString *)title 149 | { 150 | _title = title; 151 | [self.labelTitle setText:title]; 152 | } 153 | 154 | - (void)setFont:(UIFont *)font 155 | { 156 | _font = font; 157 | [self.buttonLeft.titleLabel setFont:font]; 158 | [self.buttonRight.titleLabel setFont:font]; 159 | [self.labelTitle setFont:font]; 160 | } 161 | 162 | - (void)setTitleColor:(UIColor *)titleColor 163 | { 164 | _titleColor = titleColor; 165 | [self.labelTitle setTextColor:titleColor]; 166 | [self.buttonLeft setTitleColor:titleColor forState:UIControlStateNormal]; 167 | [self.buttonRight setTitleColor:titleColor forState:UIControlStateNormal]; 168 | } 169 | 170 | - (void)setBorderButtonColor:(UIColor *)borderButtonColor 171 | { 172 | _borderButtonColor = borderButtonColor; 173 | [self.buttonLeft addBorderColor:borderButtonColor]; 174 | [self.buttonRight addBorderColor:borderButtonColor]; 175 | } 176 | 177 | - (void)setHeightPicker:(CGFloat)heightPicker 178 | { 179 | _heightPicker = heightPicker; 180 | self.contentView.st_height = heightPicker; 181 | } 182 | 183 | - (void)setContentMode:(STPickerContentMode)contentMode 184 | { 185 | _contentMode = contentMode; 186 | if (contentMode == STPickerContentModeCenter) { 187 | self.contentView.st_height = self.heightPicker + STControlSystemHeight; 188 | }else { 189 | self.contentView.st_height = self.heightPicker; 190 | } 191 | } 192 | #pragma mark - --- getters 属性 --- 193 | - (UIView *)contentView 194 | { 195 | if (!_contentView) { 196 | CGFloat contentX = 0; 197 | CGFloat contentY = STScreenHeight; 198 | CGFloat contentW = STScreenWidth; 199 | CGFloat contentH = self.heightPicker; 200 | _contentView = [[UIView alloc]initWithFrame:CGRectMake(contentX, contentY, contentW, contentH)]; 201 | [_contentView setBackgroundColor:[UIColor whiteColor]]; 202 | _contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; 203 | } 204 | return _contentView; 205 | } 206 | 207 | - (UIView *)lineView 208 | { 209 | if (!_lineView) { 210 | CGFloat lineX = 0; 211 | CGFloat lineY = STControlSystemHeight; 212 | CGFloat lineW = self.contentView.st_width; 213 | CGFloat lineH = 0.5; 214 | _lineView = [[UIView alloc]initWithFrame:CGRectMake(lineX, lineY, lineW, lineH)]; 215 | [_lineView setBackgroundColor:self.borderButtonColor]; 216 | _lineView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 217 | } 218 | return _lineView; 219 | } 220 | 221 | - (UIPickerView *)pickerView 222 | { 223 | if (!_pickerView) { 224 | CGFloat pickerW = self.contentView.st_width; 225 | CGFloat pickerH = self.contentView.st_height - self.lineView.st_bottom; 226 | CGFloat pickerX = 0; 227 | CGFloat pickerY = self.lineView.st_bottom; 228 | _pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(pickerX, pickerY, pickerW, pickerH)]; 229 | [_pickerView setBackgroundColor:[UIColor whiteColor]]; 230 | _pickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 231 | } 232 | return _pickerView; 233 | } 234 | 235 | - (UIButton *)buttonLeft 236 | { 237 | if (!_buttonLeft) { 238 | CGFloat leftW = STButtonSystemHeight; 239 | CGFloat leftH = self.lineView.st_top - STMargin; 240 | CGFloat leftX = STMarginBig; 241 | CGFloat leftY = (self.lineView.st_top - leftH) / 2; 242 | _buttonLeft = [[UIButton alloc]initWithFrame:CGRectMake(leftX, leftY, leftW, leftH)]; 243 | [_buttonLeft setTitle:@"取消" forState:UIControlStateNormal]; 244 | [_buttonLeft setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal]; 245 | [_buttonLeft addBorderColor:self.borderButtonColor]; 246 | [_buttonLeft.titleLabel setFont:self.font]; 247 | [_buttonLeft addTarget:self action:@selector(selectedCancel) forControlEvents:UIControlEventTouchUpInside]; 248 | _buttonLeft.autoresizingMask = UIViewAutoresizingFlexibleRightMargin; 249 | } 250 | return _buttonLeft; 251 | } 252 | 253 | - (UIButton *)buttonRight 254 | { 255 | if (!_buttonRight) { 256 | CGFloat rightW = self.buttonLeft.st_width; 257 | CGFloat rightH = self.buttonLeft.st_height; 258 | CGFloat rightX = self.contentView.st_width - rightW - self.buttonLeft.st_x; 259 | CGFloat rightY = self.buttonLeft.st_y; 260 | _buttonRight = [[UIButton alloc]initWithFrame:CGRectMake(rightX, rightY, rightW, rightH)]; 261 | [_buttonRight setTitle:@"确定" forState:UIControlStateNormal]; 262 | [_buttonRight setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 263 | [_buttonRight addBorderColor:self.borderButtonColor]; 264 | [_buttonRight.titleLabel setFont:self.font]; 265 | [_buttonRight addTarget:self action:@selector(selectedOk) forControlEvents:UIControlEventTouchUpInside]; 266 | _buttonRight.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 267 | } 268 | return _buttonRight; 269 | } 270 | 271 | - (UILabel *)labelTitle 272 | { 273 | if (!_labelTitle) { 274 | CGFloat titleX = self.buttonLeft.st_right + STMarginSmall; 275 | CGFloat titleY = 0; 276 | CGFloat titleW = self.contentView.st_width - titleX * 2; 277 | CGFloat titleH = self.lineView.st_top; 278 | _labelTitle = [[UILabel alloc]initWithFrame:CGRectMake(titleX, titleY, titleW, titleH)]; 279 | [_labelTitle setTextAlignment:NSTextAlignmentCenter]; 280 | [_labelTitle setTextColor:self.titleColor]; 281 | [_labelTitle setFont:self.font]; 282 | _labelTitle.adjustsFontSizeToFitWidth = YES; 283 | _labelTitle.autoresizingMask = UIViewAutoresizingFlexibleWidth; 284 | } 285 | return _labelTitle; 286 | } 287 | 288 | - (UIView *)lineViewDown 289 | { 290 | if (!_lineViewDown) { 291 | CGFloat lineX = 0; 292 | CGFloat lineY = self.pickerView.st_bottom; 293 | CGFloat lineW = self.contentView.st_width; 294 | CGFloat lineH = 0.5; 295 | _lineViewDown = [[UIView alloc]initWithFrame:CGRectMake(lineX, lineY, lineW, lineH)]; 296 | [_lineViewDown setBackgroundColor:self.borderButtonColor]; 297 | _lineViewDown.autoresizingMask = UIViewAutoresizingFlexibleWidth; 298 | } 299 | return _lineViewDown; 300 | } 301 | 302 | - (BOOL)isIphonePlus{ 303 | return (CGRectGetHeight([UIScreen mainScreen].bounds) >= 736) | 304 | (CGRectGetWidth([UIScreen mainScreen].bounds) >= 736); 305 | } 306 | 307 | @end 308 | 309 | -------------------------------------------------------------------------------- /STPickerView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 708431021EBC19C300EE96D7 /* NSCalendar+STPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A436091E20888E001601A4 /* NSCalendar+STPicker.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 708431031EBC19C300EE96D7 /* STPickerArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A4360B1E20888E001601A4 /* STPickerArea.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 708431041EBC19C300EE96D7 /* STPickerDate.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A4360D1E20888E001601A4 /* STPickerDate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | 708431051EBC19C300EE96D7 /* STPickerSingle.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A4360F1E20888F001601A4 /* STPickerSingle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 708431061EBC19C300EE96D7 /* STPickerView.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A436111E20888F001601A4 /* STPickerView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15 | 708431091EBC19C300EE96D7 /* STPickerViewUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A436161E20888F001601A4 /* STPickerViewUI.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | 70A435F81E208863001601A4 /* area.plist in Resources */ = {isa = PBXBuildFile; fileRef = 70A435E41E208863001601A4 /* area.plist */; }; 17 | 70A4361B1E20888F001601A4 /* NSCalendar+STPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A4360A1E20888E001601A4 /* NSCalendar+STPicker.m */; }; 18 | 70A4361D1E20888F001601A4 /* STPickerArea.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A4360C1E20888E001601A4 /* STPickerArea.m */; }; 19 | 70A4361F1E20888F001601A4 /* STPickerDate.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A4360E1E20888E001601A4 /* STPickerDate.m */; }; 20 | 70A436211E20888F001601A4 /* STPickerSingle.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A436101E20888F001601A4 /* STPickerSingle.m */; }; 21 | 70A436231E20888F001601A4 /* STPickerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A436121E20888F001601A4 /* STPickerView.m */; }; 22 | 70A436281E20888F001601A4 /* STPickerViewUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A436171E20888F001601A4 /* STPickerViewUI.m */; }; 23 | 70B0DEC21EBC55F400837A55 /* UIView+STPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 70B0DEC01EBC55F400837A55 /* UIView+STPicker.h */; }; 24 | 70B0DEC31EBC55F400837A55 /* UIView+STPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 70B0DEC11EBC55F400837A55 /* UIView+STPicker.m */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | 70A435B11E20877E001601A4 /* STPickerView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = STPickerView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 70A435E01E208863001601A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 70A435E41E208863001601A4 /* area.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = area.plist; sourceTree = ""; }; 31 | 70A436091E20888E001601A4 /* NSCalendar+STPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSCalendar+STPicker.h"; sourceTree = ""; }; 32 | 70A4360A1E20888E001601A4 /* NSCalendar+STPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSCalendar+STPicker.m"; sourceTree = ""; }; 33 | 70A4360B1E20888E001601A4 /* STPickerArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerArea.h; sourceTree = ""; }; 34 | 70A4360C1E20888E001601A4 /* STPickerArea.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerArea.m; sourceTree = ""; }; 35 | 70A4360D1E20888E001601A4 /* STPickerDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerDate.h; sourceTree = ""; }; 36 | 70A4360E1E20888E001601A4 /* STPickerDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerDate.m; sourceTree = ""; }; 37 | 70A4360F1E20888F001601A4 /* STPickerSingle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerSingle.h; sourceTree = ""; }; 38 | 70A436101E20888F001601A4 /* STPickerSingle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerSingle.m; sourceTree = ""; }; 39 | 70A436111E20888F001601A4 /* STPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerView.h; sourceTree = ""; }; 40 | 70A436121E20888F001601A4 /* STPickerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerView.m; sourceTree = ""; }; 41 | 70A436161E20888F001601A4 /* STPickerViewUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerViewUI.h; sourceTree = ""; }; 42 | 70A436171E20888F001601A4 /* STPickerViewUI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerViewUI.m; sourceTree = ""; }; 43 | 70B0DEC01EBC55F400837A55 /* UIView+STPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+STPicker.h"; sourceTree = ""; }; 44 | 70B0DEC11EBC55F400837A55 /* UIView+STPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+STPicker.m"; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 70A435AD1E20877E001601A4 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 70A435A71E20877E001601A4 = { 59 | isa = PBXGroup; 60 | children = ( 61 | 70A435DE1E208863001601A4 /* STPickerView */, 62 | 70A435B21E20877E001601A4 /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 70A435B21E20877E001601A4 /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 70A435B11E20877E001601A4 /* STPickerView.framework */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 70A435DE1E208863001601A4 /* STPickerView */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 70A436081E20888E001601A4 /* STPickerView */, 78 | 70A435DF1E208863001601A4 /* FramewordInfo */, 79 | 70A435E31E208863001601A4 /* Resource */, 80 | ); 81 | path = STPickerView; 82 | sourceTree = ""; 83 | }; 84 | 70A435DF1E208863001601A4 /* FramewordInfo */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 70A435E01E208863001601A4 /* Info.plist */, 88 | ); 89 | path = FramewordInfo; 90 | sourceTree = ""; 91 | }; 92 | 70A435E31E208863001601A4 /* Resource */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 70A435E41E208863001601A4 /* area.plist */, 96 | ); 97 | path = Resource; 98 | sourceTree = ""; 99 | }; 100 | 70A436081E20888E001601A4 /* STPickerView */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 70A436091E20888E001601A4 /* NSCalendar+STPicker.h */, 104 | 70A4360A1E20888E001601A4 /* NSCalendar+STPicker.m */, 105 | 70A4360B1E20888E001601A4 /* STPickerArea.h */, 106 | 70A4360C1E20888E001601A4 /* STPickerArea.m */, 107 | 70A4360D1E20888E001601A4 /* STPickerDate.h */, 108 | 70A4360E1E20888E001601A4 /* STPickerDate.m */, 109 | 70A4360F1E20888F001601A4 /* STPickerSingle.h */, 110 | 70A436101E20888F001601A4 /* STPickerSingle.m */, 111 | 70A436111E20888F001601A4 /* STPickerView.h */, 112 | 70A436121E20888F001601A4 /* STPickerView.m */, 113 | 70A436161E20888F001601A4 /* STPickerViewUI.h */, 114 | 70A436171E20888F001601A4 /* STPickerViewUI.m */, 115 | 70B0DEC01EBC55F400837A55 /* UIView+STPicker.h */, 116 | 70B0DEC11EBC55F400837A55 /* UIView+STPicker.m */, 117 | ); 118 | path = STPickerView; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXHeadersBuildPhase section */ 124 | 70A435AE1E20877E001601A4 /* Headers */ = { 125 | isa = PBXHeadersBuildPhase; 126 | buildActionMask = 2147483647; 127 | files = ( 128 | 708431021EBC19C300EE96D7 /* NSCalendar+STPicker.h in Headers */, 129 | 708431031EBC19C300EE96D7 /* STPickerArea.h in Headers */, 130 | 708431041EBC19C300EE96D7 /* STPickerDate.h in Headers */, 131 | 708431051EBC19C300EE96D7 /* STPickerSingle.h in Headers */, 132 | 708431061EBC19C300EE96D7 /* STPickerView.h in Headers */, 133 | 708431091EBC19C300EE96D7 /* STPickerViewUI.h in Headers */, 134 | 70B0DEC21EBC55F400837A55 /* UIView+STPicker.h in Headers */, 135 | ); 136 | runOnlyForDeploymentPostprocessing = 0; 137 | }; 138 | /* End PBXHeadersBuildPhase section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | 70A435B01E20877E001601A4 /* STPickerView */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 70A435B91E20877E001601A4 /* Build configuration list for PBXNativeTarget "STPickerView" */; 144 | buildPhases = ( 145 | 70A435AC1E20877E001601A4 /* Sources */, 146 | 70A435AD1E20877E001601A4 /* Frameworks */, 147 | 70A435AE1E20877E001601A4 /* Headers */, 148 | 70A435AF1E20877E001601A4 /* Resources */, 149 | ); 150 | buildRules = ( 151 | ); 152 | dependencies = ( 153 | ); 154 | name = STPickerView; 155 | productName = STPickerView; 156 | productReference = 70A435B11E20877E001601A4 /* STPickerView.framework */; 157 | productType = "com.apple.product-type.framework"; 158 | }; 159 | /* End PBXNativeTarget section */ 160 | 161 | /* Begin PBXProject section */ 162 | 70A435A81E20877E001601A4 /* Project object */ = { 163 | isa = PBXProject; 164 | attributes = { 165 | LastUpgradeCheck = 0810; 166 | ORGANIZATIONNAME = ST; 167 | TargetAttributes = { 168 | 70A435B01E20877E001601A4 = { 169 | CreatedOnToolsVersion = 8.1; 170 | DevelopmentTeam = Z25J3BA353; 171 | ProvisioningStyle = Automatic; 172 | }; 173 | }; 174 | }; 175 | buildConfigurationList = 70A435AB1E20877E001601A4 /* Build configuration list for PBXProject "STPickerView" */; 176 | compatibilityVersion = "Xcode 3.2"; 177 | developmentRegion = English; 178 | hasScannedForEncodings = 0; 179 | knownRegions = ( 180 | en, 181 | ); 182 | mainGroup = 70A435A71E20877E001601A4; 183 | productRefGroup = 70A435B21E20877E001601A4 /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 70A435B01E20877E001601A4 /* STPickerView */, 188 | ); 189 | }; 190 | /* End PBXProject section */ 191 | 192 | /* Begin PBXResourcesBuildPhase section */ 193 | 70A435AF1E20877E001601A4 /* Resources */ = { 194 | isa = PBXResourcesBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | 70A435F81E208863001601A4 /* area.plist in Resources */, 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXResourcesBuildPhase section */ 202 | 203 | /* Begin PBXSourcesBuildPhase section */ 204 | 70A435AC1E20877E001601A4 /* Sources */ = { 205 | isa = PBXSourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | 70A4361F1E20888F001601A4 /* STPickerDate.m in Sources */, 209 | 70A436281E20888F001601A4 /* STPickerViewUI.m in Sources */, 210 | 70A4361B1E20888F001601A4 /* NSCalendar+STPicker.m in Sources */, 211 | 70A436211E20888F001601A4 /* STPickerSingle.m in Sources */, 212 | 70B0DEC31EBC55F400837A55 /* UIView+STPicker.m in Sources */, 213 | 70A436231E20888F001601A4 /* STPickerView.m in Sources */, 214 | 70A4361D1E20888F001601A4 /* STPickerArea.m in Sources */, 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXSourcesBuildPhase section */ 219 | 220 | /* Begin XCBuildConfiguration section */ 221 | 70A435B71E20877E001601A4 /* Debug */ = { 222 | isa = XCBuildConfiguration; 223 | buildSettings = { 224 | ALWAYS_SEARCH_USER_PATHS = NO; 225 | CLANG_ANALYZER_NONNULL = YES; 226 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 227 | CLANG_CXX_LIBRARY = "libc++"; 228 | CLANG_ENABLE_MODULES = YES; 229 | CLANG_ENABLE_OBJC_ARC = YES; 230 | CLANG_WARN_BOOL_CONVERSION = YES; 231 | CLANG_WARN_CONSTANT_CONVERSION = YES; 232 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 233 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 234 | CLANG_WARN_EMPTY_BODY = YES; 235 | CLANG_WARN_ENUM_CONVERSION = YES; 236 | CLANG_WARN_INFINITE_RECURSION = YES; 237 | CLANG_WARN_INT_CONVERSION = YES; 238 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 239 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 240 | CLANG_WARN_UNREACHABLE_CODE = YES; 241 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 242 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 243 | COPY_PHASE_STRIP = NO; 244 | CURRENT_PROJECT_VERSION = 1; 245 | DEBUG_INFORMATION_FORMAT = dwarf; 246 | ENABLE_STRICT_OBJC_MSGSEND = YES; 247 | ENABLE_TESTABILITY = YES; 248 | GCC_C_LANGUAGE_STANDARD = gnu99; 249 | GCC_DYNAMIC_NO_PIC = NO; 250 | GCC_NO_COMMON_BLOCKS = YES; 251 | GCC_OPTIMIZATION_LEVEL = 0; 252 | GCC_PREPROCESSOR_DEFINITIONS = ( 253 | "DEBUG=1", 254 | "$(inherited)", 255 | ); 256 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 257 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 258 | GCC_WARN_UNDECLARED_SELECTOR = YES; 259 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 260 | GCC_WARN_UNUSED_FUNCTION = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 263 | MTL_ENABLE_DEBUG_INFO = YES; 264 | ONLY_ACTIVE_ARCH = NO; 265 | SDKROOT = iphoneos; 266 | TARGETED_DEVICE_FAMILY = "1,2"; 267 | VERSIONING_SYSTEM = "apple-generic"; 268 | VERSION_INFO_PREFIX = ""; 269 | }; 270 | name = Debug; 271 | }; 272 | 70A435B81E20877E001601A4 /* Release */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | ALWAYS_SEARCH_USER_PATHS = NO; 276 | CLANG_ANALYZER_NONNULL = YES; 277 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 278 | CLANG_CXX_LIBRARY = "libc++"; 279 | CLANG_ENABLE_MODULES = YES; 280 | CLANG_ENABLE_OBJC_ARC = YES; 281 | CLANG_WARN_BOOL_CONVERSION = YES; 282 | CLANG_WARN_CONSTANT_CONVERSION = YES; 283 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 284 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 285 | CLANG_WARN_EMPTY_BODY = YES; 286 | CLANG_WARN_ENUM_CONVERSION = YES; 287 | CLANG_WARN_INFINITE_RECURSION = YES; 288 | CLANG_WARN_INT_CONVERSION = YES; 289 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 290 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 291 | CLANG_WARN_UNREACHABLE_CODE = YES; 292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 293 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 294 | COPY_PHASE_STRIP = NO; 295 | CURRENT_PROJECT_VERSION = 1; 296 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 297 | ENABLE_NS_ASSERTIONS = NO; 298 | ENABLE_STRICT_OBJC_MSGSEND = YES; 299 | GCC_C_LANGUAGE_STANDARD = gnu99; 300 | GCC_NO_COMMON_BLOCKS = YES; 301 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 302 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 303 | GCC_WARN_UNDECLARED_SELECTOR = YES; 304 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 305 | GCC_WARN_UNUSED_FUNCTION = YES; 306 | GCC_WARN_UNUSED_VARIABLE = YES; 307 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 308 | MTL_ENABLE_DEBUG_INFO = NO; 309 | ONLY_ACTIVE_ARCH = NO; 310 | SDKROOT = iphoneos; 311 | TARGETED_DEVICE_FAMILY = "1,2"; 312 | VALIDATE_PRODUCT = YES; 313 | VERSIONING_SYSTEM = "apple-generic"; 314 | VERSION_INFO_PREFIX = ""; 315 | }; 316 | name = Release; 317 | }; 318 | 70A435BA1E20877E001601A4 /* Debug */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | CODE_SIGN_IDENTITY = ""; 322 | DEFINES_MODULE = YES; 323 | DEVELOPMENT_TEAM = Z25J3BA353; 324 | DYLIB_COMPATIBILITY_VERSION = 1; 325 | DYLIB_CURRENT_VERSION = 1; 326 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 327 | INFOPLIST_FILE = "$(SRCROOT)/STPickerView/FramewordInfo/Info.plist"; 328 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 329 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 330 | MACH_O_TYPE = staticlib; 331 | ONLY_ACTIVE_ARCH = NO; 332 | PRODUCT_BUNDLE_IDENTIFIER = com.st.cn.STPickerView; 333 | PRODUCT_NAME = "$(TARGET_NAME)"; 334 | SKIP_INSTALL = YES; 335 | TARGETED_DEVICE_FAMILY = 1; 336 | }; 337 | name = Debug; 338 | }; 339 | 70A435BB1E20877E001601A4 /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | CODE_SIGN_IDENTITY = ""; 343 | DEFINES_MODULE = YES; 344 | DEVELOPMENT_TEAM = Z25J3BA353; 345 | DYLIB_COMPATIBILITY_VERSION = 1; 346 | DYLIB_CURRENT_VERSION = 1; 347 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 348 | INFOPLIST_FILE = "$(SRCROOT)/STPickerView/FramewordInfo/Info.plist"; 349 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 351 | MACH_O_TYPE = staticlib; 352 | ONLY_ACTIVE_ARCH = NO; 353 | PRODUCT_BUNDLE_IDENTIFIER = com.st.cn.STPickerView; 354 | PRODUCT_NAME = "$(TARGET_NAME)"; 355 | SKIP_INSTALL = YES; 356 | TARGETED_DEVICE_FAMILY = 1; 357 | }; 358 | name = Release; 359 | }; 360 | /* End XCBuildConfiguration section */ 361 | 362 | /* Begin XCConfigurationList section */ 363 | 70A435AB1E20877E001601A4 /* Build configuration list for PBXProject "STPickerView" */ = { 364 | isa = XCConfigurationList; 365 | buildConfigurations = ( 366 | 70A435B71E20877E001601A4 /* Debug */, 367 | 70A435B81E20877E001601A4 /* Release */, 368 | ); 369 | defaultConfigurationIsVisible = 0; 370 | defaultConfigurationName = Release; 371 | }; 372 | 70A435B91E20877E001601A4 /* Build configuration list for PBXNativeTarget "STPickerView" */ = { 373 | isa = XCConfigurationList; 374 | buildConfigurations = ( 375 | 70A435BA1E20877E001601A4 /* Debug */, 376 | 70A435BB1E20877E001601A4 /* Release */, 377 | ); 378 | defaultConfigurationIsVisible = 0; 379 | defaultConfigurationName = Release; 380 | }; 381 | /* End XCConfigurationList section */ 382 | }; 383 | rootObject = 70A435A81E20877E001601A4 /* Project object */; 384 | } 385 | -------------------------------------------------------------------------------- /STPickerDemo/STPickerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 707B48771EBC0FE200028BF9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 707B48761EBC0FE200028BF9 /* main.m */; }; 11 | 707B48821EBC0FE200028BF9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 707B48811EBC0FE200028BF9 /* Assets.xcassets */; }; 12 | 707B48851EBC0FE200028BF9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 707B48831EBC0FE200028BF9 /* LaunchScreen.storyboard */; }; 13 | 707B48941EBC103400028BF9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 707B48901EBC103400028BF9 /* AppDelegate.m */; }; 14 | 707B48951EBC103400028BF9 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 707B48921EBC103400028BF9 /* ViewController.m */; }; 15 | 707B48961EBC103400028BF9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 707B48931EBC103400028BF9 /* Main.storyboard */; }; 16 | 708431251EBC1BEE00EE96D7 /* area.plist in Resources */ = {isa = PBXBuildFile; fileRef = 708431111EBC1BEE00EE96D7 /* area.plist */; }; 17 | 708431271EBC1BEE00EE96D7 /* STPickerArea.m in Sources */ = {isa = PBXBuildFile; fileRef = 708431161EBC1BEE00EE96D7 /* STPickerArea.m */; }; 18 | 708431281EBC1BEE00EE96D7 /* STPickerDate.m in Sources */ = {isa = PBXBuildFile; fileRef = 708431181EBC1BEE00EE96D7 /* STPickerDate.m */; }; 19 | 708431291EBC1BEE00EE96D7 /* STPickerSingle.m in Sources */ = {isa = PBXBuildFile; fileRef = 7084311A1EBC1BEE00EE96D7 /* STPickerSingle.m */; }; 20 | 7084312A1EBC1BEE00EE96D7 /* STPickerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7084311C1EBC1BEE00EE96D7 /* STPickerView.m */; }; 21 | 7084312C1EBC1BEE00EE96D7 /* STPickerViewUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 708431211EBC1BEE00EE96D7 /* STPickerViewUI.m */; }; 22 | 7084312D1EBC1BEE00EE96D7 /* UIView+STPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 708431231EBC1BEE00EE96D7 /* UIView+STPicker.m */; }; 23 | 70B0DEBF1EBC55CA00837A55 /* NSCalendar+STPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 70B0DEBE1EBC55CA00837A55 /* NSCalendar+STPicker.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 707B48721EBC0FE200028BF9 /* STPickerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = STPickerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 707B48761EBC0FE200028BF9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | 707B48811EBC0FE200028BF9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | 707B48841EBC0FE200028BF9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | 707B48861EBC0FE200028BF9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 707B488F1EBC103400028BF9 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 33 | 707B48901EBC103400028BF9 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 34 | 707B48911EBC103400028BF9 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 35 | 707B48921EBC103400028BF9 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 36 | 707B48931EBC103400028BF9 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 37 | 708431111EBC1BEE00EE96D7 /* area.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = area.plist; sourceTree = ""; }; 38 | 708431151EBC1BEE00EE96D7 /* STPickerArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerArea.h; sourceTree = ""; }; 39 | 708431161EBC1BEE00EE96D7 /* STPickerArea.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerArea.m; sourceTree = ""; }; 40 | 708431171EBC1BEE00EE96D7 /* STPickerDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerDate.h; sourceTree = ""; }; 41 | 708431181EBC1BEE00EE96D7 /* STPickerDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerDate.m; sourceTree = ""; }; 42 | 708431191EBC1BEE00EE96D7 /* STPickerSingle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerSingle.h; sourceTree = ""; }; 43 | 7084311A1EBC1BEE00EE96D7 /* STPickerSingle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerSingle.m; sourceTree = ""; }; 44 | 7084311B1EBC1BEE00EE96D7 /* STPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerView.h; sourceTree = ""; }; 45 | 7084311C1EBC1BEE00EE96D7 /* STPickerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerView.m; sourceTree = ""; }; 46 | 708431201EBC1BEE00EE96D7 /* STPickerViewUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPickerViewUI.h; sourceTree = ""; }; 47 | 708431211EBC1BEE00EE96D7 /* STPickerViewUI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPickerViewUI.m; sourceTree = ""; }; 48 | 708431221EBC1BEE00EE96D7 /* UIView+STPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+STPicker.h"; sourceTree = ""; }; 49 | 708431231EBC1BEE00EE96D7 /* UIView+STPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+STPicker.m"; sourceTree = ""; }; 50 | 70B0DEBD1EBC55A100837A55 /* NSCalendar+STPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSCalendar+STPicker.h"; sourceTree = ""; }; 51 | 70B0DEBE1EBC55CA00837A55 /* NSCalendar+STPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSCalendar+STPicker.m"; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 707B486F1EBC0FE200028BF9 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 707B48691EBC0FE100028BF9 = { 66 | isa = PBXGroup; 67 | children = ( 68 | 707B48741EBC0FE200028BF9 /* STPickerDemo */, 69 | 707B48731EBC0FE200028BF9 /* Products */, 70 | 707B488C1EBC100300028BF9 /* Frameworks */, 71 | ); 72 | sourceTree = ""; 73 | }; 74 | 707B48731EBC0FE200028BF9 /* Products */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 707B48721EBC0FE200028BF9 /* STPickerDemo.app */, 78 | ); 79 | name = Products; 80 | sourceTree = ""; 81 | }; 82 | 707B48741EBC0FE200028BF9 /* STPickerDemo */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 7084310D1EBC1BEE00EE96D7 /* STPickerView */, 86 | 707B488F1EBC103400028BF9 /* AppDelegate.h */, 87 | 707B48901EBC103400028BF9 /* AppDelegate.m */, 88 | 707B48911EBC103400028BF9 /* ViewController.h */, 89 | 707B48921EBC103400028BF9 /* ViewController.m */, 90 | 707B48931EBC103400028BF9 /* Main.storyboard */, 91 | 707B48811EBC0FE200028BF9 /* Assets.xcassets */, 92 | 707B48831EBC0FE200028BF9 /* LaunchScreen.storyboard */, 93 | 707B48861EBC0FE200028BF9 /* Info.plist */, 94 | 707B48751EBC0FE200028BF9 /* Supporting Files */, 95 | ); 96 | path = STPickerDemo; 97 | sourceTree = ""; 98 | }; 99 | 707B48751EBC0FE200028BF9 /* Supporting Files */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 707B48761EBC0FE200028BF9 /* main.m */, 103 | ); 104 | name = "Supporting Files"; 105 | sourceTree = ""; 106 | }; 107 | 707B488C1EBC100300028BF9 /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | ); 111 | name = Frameworks; 112 | sourceTree = ""; 113 | }; 114 | 7084310D1EBC1BEE00EE96D7 /* STPickerView */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 708431101EBC1BEE00EE96D7 /* Resource */, 118 | 708431121EBC1BEE00EE96D7 /* STPickerView */, 119 | ); 120 | name = STPickerView; 121 | path = ../../STPickerView; 122 | sourceTree = ""; 123 | }; 124 | 708431101EBC1BEE00EE96D7 /* Resource */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 708431111EBC1BEE00EE96D7 /* area.plist */, 128 | ); 129 | path = Resource; 130 | sourceTree = ""; 131 | }; 132 | 708431121EBC1BEE00EE96D7 /* STPickerView */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 70B0DEBD1EBC55A100837A55 /* NSCalendar+STPicker.h */, 136 | 70B0DEBE1EBC55CA00837A55 /* NSCalendar+STPicker.m */, 137 | 708431151EBC1BEE00EE96D7 /* STPickerArea.h */, 138 | 708431161EBC1BEE00EE96D7 /* STPickerArea.m */, 139 | 708431171EBC1BEE00EE96D7 /* STPickerDate.h */, 140 | 708431181EBC1BEE00EE96D7 /* STPickerDate.m */, 141 | 708431191EBC1BEE00EE96D7 /* STPickerSingle.h */, 142 | 7084311A1EBC1BEE00EE96D7 /* STPickerSingle.m */, 143 | 7084311B1EBC1BEE00EE96D7 /* STPickerView.h */, 144 | 7084311C1EBC1BEE00EE96D7 /* STPickerView.m */, 145 | 708431201EBC1BEE00EE96D7 /* STPickerViewUI.h */, 146 | 708431211EBC1BEE00EE96D7 /* STPickerViewUI.m */, 147 | 708431221EBC1BEE00EE96D7 /* UIView+STPicker.h */, 148 | 708431231EBC1BEE00EE96D7 /* UIView+STPicker.m */, 149 | ); 150 | path = STPickerView; 151 | sourceTree = ""; 152 | }; 153 | /* End PBXGroup section */ 154 | 155 | /* Begin PBXNativeTarget section */ 156 | 707B48711EBC0FE200028BF9 /* STPickerDemo */ = { 157 | isa = PBXNativeTarget; 158 | buildConfigurationList = 707B48891EBC0FE200028BF9 /* Build configuration list for PBXNativeTarget "STPickerDemo" */; 159 | buildPhases = ( 160 | 707B486E1EBC0FE200028BF9 /* Sources */, 161 | 707B486F1EBC0FE200028BF9 /* Frameworks */, 162 | 707B48701EBC0FE200028BF9 /* Resources */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | ); 168 | name = STPickerDemo; 169 | productName = STPickerDemo; 170 | productReference = 707B48721EBC0FE200028BF9 /* STPickerDemo.app */; 171 | productType = "com.apple.product-type.application"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | 707B486A1EBC0FE100028BF9 /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastUpgradeCheck = 0830; 180 | ORGANIZATIONNAME = ST; 181 | TargetAttributes = { 182 | 707B48711EBC0FE200028BF9 = { 183 | CreatedOnToolsVersion = 8.2.1; 184 | DevelopmentTeam = Z25J3BA353; 185 | ProvisioningStyle = Automatic; 186 | }; 187 | }; 188 | }; 189 | buildConfigurationList = 707B486D1EBC0FE100028BF9 /* Build configuration list for PBXProject "STPickerDemo" */; 190 | compatibilityVersion = "Xcode 3.2"; 191 | developmentRegion = English; 192 | hasScannedForEncodings = 0; 193 | knownRegions = ( 194 | en, 195 | Base, 196 | ); 197 | mainGroup = 707B48691EBC0FE100028BF9; 198 | productRefGroup = 707B48731EBC0FE200028BF9 /* Products */; 199 | projectDirPath = ""; 200 | projectRoot = ""; 201 | targets = ( 202 | 707B48711EBC0FE200028BF9 /* STPickerDemo */, 203 | ); 204 | }; 205 | /* End PBXProject section */ 206 | 207 | /* Begin PBXResourcesBuildPhase section */ 208 | 707B48701EBC0FE200028BF9 /* Resources */ = { 209 | isa = PBXResourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | 708431251EBC1BEE00EE96D7 /* area.plist in Resources */, 213 | 707B48961EBC103400028BF9 /* Main.storyboard in Resources */, 214 | 707B48851EBC0FE200028BF9 /* LaunchScreen.storyboard in Resources */, 215 | 707B48821EBC0FE200028BF9 /* Assets.xcassets in Resources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | /* End PBXResourcesBuildPhase section */ 220 | 221 | /* Begin PBXSourcesBuildPhase section */ 222 | 707B486E1EBC0FE200028BF9 /* Sources */ = { 223 | isa = PBXSourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | 708431281EBC1BEE00EE96D7 /* STPickerDate.m in Sources */, 227 | 7084312A1EBC1BEE00EE96D7 /* STPickerView.m in Sources */, 228 | 707B48951EBC103400028BF9 /* ViewController.m in Sources */, 229 | 707B48941EBC103400028BF9 /* AppDelegate.m in Sources */, 230 | 707B48771EBC0FE200028BF9 /* main.m in Sources */, 231 | 70B0DEBF1EBC55CA00837A55 /* NSCalendar+STPicker.m in Sources */, 232 | 708431271EBC1BEE00EE96D7 /* STPickerArea.m in Sources */, 233 | 7084312D1EBC1BEE00EE96D7 /* UIView+STPicker.m in Sources */, 234 | 708431291EBC1BEE00EE96D7 /* STPickerSingle.m in Sources */, 235 | 7084312C1EBC1BEE00EE96D7 /* STPickerViewUI.m in Sources */, 236 | ); 237 | runOnlyForDeploymentPostprocessing = 0; 238 | }; 239 | /* End PBXSourcesBuildPhase section */ 240 | 241 | /* Begin PBXVariantGroup section */ 242 | 707B48831EBC0FE200028BF9 /* LaunchScreen.storyboard */ = { 243 | isa = PBXVariantGroup; 244 | children = ( 245 | 707B48841EBC0FE200028BF9 /* Base */, 246 | ); 247 | name = LaunchScreen.storyboard; 248 | sourceTree = ""; 249 | }; 250 | /* End PBXVariantGroup section */ 251 | 252 | /* Begin XCBuildConfiguration section */ 253 | 707B48871EBC0FE200028BF9 /* Debug */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ALWAYS_SEARCH_USER_PATHS = NO; 257 | CLANG_ANALYZER_NONNULL = YES; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 266 | CLANG_WARN_EMPTY_BODY = YES; 267 | CLANG_WARN_ENUM_CONVERSION = YES; 268 | CLANG_WARN_INFINITE_RECURSION = YES; 269 | CLANG_WARN_INT_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 272 | CLANG_WARN_UNREACHABLE_CODE = YES; 273 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 274 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 275 | COPY_PHASE_STRIP = NO; 276 | DEBUG_INFORMATION_FORMAT = dwarf; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | ENABLE_TESTABILITY = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_DYNAMIC_NO_PIC = NO; 281 | GCC_NO_COMMON_BLOCKS = YES; 282 | GCC_OPTIMIZATION_LEVEL = 0; 283 | GCC_PREPROCESSOR_DEFINITIONS = ( 284 | "DEBUG=1", 285 | "$(inherited)", 286 | ); 287 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 288 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 289 | GCC_WARN_UNDECLARED_SELECTOR = YES; 290 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 291 | GCC_WARN_UNUSED_FUNCTION = YES; 292 | GCC_WARN_UNUSED_VARIABLE = YES; 293 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 294 | MTL_ENABLE_DEBUG_INFO = YES; 295 | ONLY_ACTIVE_ARCH = YES; 296 | SDKROOT = iphoneos; 297 | }; 298 | name = Debug; 299 | }; 300 | 707B48881EBC0FE200028BF9 /* Release */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ALWAYS_SEARCH_USER_PATHS = NO; 304 | CLANG_ANALYZER_NONNULL = YES; 305 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 306 | CLANG_CXX_LIBRARY = "libc++"; 307 | CLANG_ENABLE_MODULES = YES; 308 | CLANG_ENABLE_OBJC_ARC = YES; 309 | CLANG_WARN_BOOL_CONVERSION = YES; 310 | CLANG_WARN_CONSTANT_CONVERSION = YES; 311 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 312 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 313 | CLANG_WARN_EMPTY_BODY = YES; 314 | CLANG_WARN_ENUM_CONVERSION = YES; 315 | CLANG_WARN_INFINITE_RECURSION = YES; 316 | CLANG_WARN_INT_CONVERSION = YES; 317 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 318 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 319 | CLANG_WARN_UNREACHABLE_CODE = YES; 320 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 321 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 322 | COPY_PHASE_STRIP = NO; 323 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 324 | ENABLE_NS_ASSERTIONS = NO; 325 | ENABLE_STRICT_OBJC_MSGSEND = YES; 326 | GCC_C_LANGUAGE_STANDARD = gnu99; 327 | GCC_NO_COMMON_BLOCKS = YES; 328 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 329 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 330 | GCC_WARN_UNDECLARED_SELECTOR = YES; 331 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 332 | GCC_WARN_UNUSED_FUNCTION = YES; 333 | GCC_WARN_UNUSED_VARIABLE = YES; 334 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 335 | MTL_ENABLE_DEBUG_INFO = NO; 336 | ONLY_ACTIVE_ARCH = NO; 337 | SDKROOT = iphoneos; 338 | VALIDATE_PRODUCT = YES; 339 | }; 340 | name = Release; 341 | }; 342 | 707B488A1EBC0FE200028BF9 /* Debug */ = { 343 | isa = XCBuildConfiguration; 344 | buildSettings = { 345 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 346 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 347 | DEVELOPMENT_TEAM = Z25J3BA353; 348 | FRAMEWORK_SEARCH_PATHS = ( 349 | "$(inherited)", 350 | "$(PROJECT_DIR)", 351 | ); 352 | INFOPLIST_FILE = STPickerDemo/Info.plist; 353 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 354 | PRODUCT_BUNDLE_IDENTIFIER = com.st.cn.st2; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | PROVISIONING_PROFILE_SPECIFIER = ""; 357 | }; 358 | name = Debug; 359 | }; 360 | 707B488B1EBC0FE200028BF9 /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 365 | DEVELOPMENT_TEAM = Z25J3BA353; 366 | FRAMEWORK_SEARCH_PATHS = ( 367 | "$(inherited)", 368 | "$(PROJECT_DIR)", 369 | ); 370 | INFOPLIST_FILE = STPickerDemo/Info.plist; 371 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 372 | PRODUCT_BUNDLE_IDENTIFIER = com.st.cn.st2; 373 | PRODUCT_NAME = "$(TARGET_NAME)"; 374 | PROVISIONING_PROFILE_SPECIFIER = ""; 375 | }; 376 | name = Release; 377 | }; 378 | /* End XCBuildConfiguration section */ 379 | 380 | /* Begin XCConfigurationList section */ 381 | 707B486D1EBC0FE100028BF9 /* Build configuration list for PBXProject "STPickerDemo" */ = { 382 | isa = XCConfigurationList; 383 | buildConfigurations = ( 384 | 707B48871EBC0FE200028BF9 /* Debug */, 385 | 707B48881EBC0FE200028BF9 /* Release */, 386 | ); 387 | defaultConfigurationIsVisible = 0; 388 | defaultConfigurationName = Release; 389 | }; 390 | 707B48891EBC0FE200028BF9 /* Build configuration list for PBXNativeTarget "STPickerDemo" */ = { 391 | isa = XCConfigurationList; 392 | buildConfigurations = ( 393 | 707B488A1EBC0FE200028BF9 /* Debug */, 394 | 707B488B1EBC0FE200028BF9 /* Release */, 395 | ); 396 | defaultConfigurationIsVisible = 0; 397 | defaultConfigurationName = Release; 398 | }; 399 | /* End XCConfigurationList section */ 400 | }; 401 | rootObject = 707B486A1EBC0FE100028BF9 /* Project object */; 402 | } 403 | --------------------------------------------------------------------------------