使用 CocoaPods,将以下行添加到您的 Podfile
中。
pod 'SHDatePicker'
并运行 pod install
,然后您就完成了!
SHDatePicker *datePicker = [[SHDatePicker alloc] initWithCompleteHandle:^(NSDate *selectedDate, NSString *selectedDateString) {
code...
}];
[datePicker updateHiddenStatus];
一个简单的日期选择器。您可以自定义分钟间隔和显示多少天。
首次初始化和计算默认数据源只需 95ms。因此,无需担心性能。数据源仅在时间间隔后刷新
默认初始化
// default dayCount is 7 days;
// default minuteInterval is 5 minutes;
// default firstMinuteInterval is 5 * 60 secend;
- (instancetype)initWithCompleteHandle:(SHDatePickerCompleteHandle)completeHandle;
自定义初始化
- (instancetype)initWithDefaultDayCount:(NSInteger)dayCount
minuteInterval:(NSInteger)minuteInterval
firstMinuteInterval:(NSInteger)firstMinuteInterval
customLanguage:(SHDateLanguageModel *)customLanguage
completeHandle:(SHDatePickerCompleteHandle)completeHandle;
自定义您的本地语言
默认语言将与您的本地语言相同(仅支持英语或中文)。但您可以自定义,如您所愿。如果您的语言是英语或中文,您将不需要设置所有属性,空属性将自动填充为与您的本地语言相同。
@interface SHDateLanguageModel : NSObject
@property (nonatomic, strong) NSString *today;
@property (nonatomic, strong) NSString *tomorrow;
@property (nonatomic, strong) NSString *hour;
@property (nonatomic, strong) NSString *minute;
@property (nonatomic, strong) NSString *done;
@property (nonatomic, strong) NSString *cancel;
@harushuu, [email protected]
英语:SHDatePicker 可在 MIT 许可证下使用,有关更多信息,请参阅 License 文件。