LTHMonthYearPickerView 1.4.5

LTHMonthYearPickerView 1.4.5

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2018年8月

Roland Leth 维护。




  • Roland Leth

LTHMonthYearPickerView

针对麻烦的信用卡到期日期等简单易用的月份和年份选择视图。

如何使用

LTHMonthYearPickerView 的内容拖动到您的项目中,或将 pod 'LTHMonthYearPickerView' 添加到您的 podspec 文件中。

/**
 *  Month / Year picker view, for those pesky Credit Card expiration dates and alike.
 *
 *  @param date           set to a date if you want the picker to be initialized with a specific month and year, otherwise it is initialized with the current month and year.
 *  @param shortMonths    set to YES if you want months to be returned as Jan, Feb, etc, set to NO if you want months to be returned as January, February, etc.
 *  @param numberedMonths set to YES if you want months to be returned as 01, 02, etc. This takes precedence over shortMonths if set to YES.
 *  @param showToolbar    set to YES if you want the picker to have a Cancel/Done toolbar.
 *
 *  @return a container view which contains the UIPicker and toolbar
 */
_monthYearPicker = [[LTHMonthYearPickerView alloc] initWithDate: [NSDate date]
																	 shortMonths: NO
												 				 numberedMonths: NO
													 				  andToolbar: YES];
_monthYearPicker.delegate = self;

提供了几个委托方法

- (void)pickerDidSelectRow:(NSInteger)row inComponent:(NSInteger)component;
- (void)pickerDidSelectMonth:(NSString *)month;
- (void)pickerDidSelectYear:(NSString *)year;
- (void)pickerDidSelectMonth:(NSString *)month andYear:(NSString *)year;
- (void)pickerDidPressDoneWithMonth:(NSString *)month andYear:(NSString *)year;
- (void)pickerDidPressCancel;
- (void)pickerDidPressCancelWithInitialValues:(NSDictionary *)initialValues;
// Or corresponding notifications; if you prefer it like that, just uncomment the notification posts.

所有这些都可通过宏和常量轻松定制,从月份和年份字体和颜色(个别)到月份名称,如果您需要其他语言的月份名称(控制已创建很久,并未真正考虑合适的本地化)。

Screenshot

使用此控件的应用

如果您使用此控件,我会很高兴听到您的反馈!

许可证

遵守 MIT 许可。如果您(或需要)想要没有归属的许可证,请随时 联系我