一个像Google Calendar Android App一样的自定义时间选择器
使用cocoapods
pod 'ESTimePicker'
然后导入所需.h文件
#import "ESTimePicker.h"
- (void)viewDidLoad
{
ESTimePicker *timePicker = [[ESTimePicker alloc] initWithDelegate:self]; // Delegate is optional
[timePicker setFrame:CGRectMake(10, 100, 300, 300)];
[self.view addSubview:timePicker];
}
- (void)timePickerHoursChanged:(ESTimePicker *)timePicker toHours:(int)hours
{
[hoursLabel setText:[NSString stringWithFormat:@"%i", hours]];
}
- (void)timePickerMinutesChanged:(ESTimePicker *)timePicker toMinutes:(int)minutes
{
[minutesLabel setText:[NSString stringWithFormat:@"%i", minutes]];
}
官方文档可在此处找到http://cocoadocs.org/docsets/ESTimePicker/。
这个类使用ESMathUtils
类(包含其中)
版权(C)2014 e-sites,http://e-sites.nl/。受BSD许可证授权。