标签:
1、添加文件GoYearMonthDayPickerView.h .m .xib、NSDate+Helper.h .m、iCarousel.h .m
2、在Lable上显示日期
UILabel *ageLabel = [[UILabel alloc]initWithFrame:CGRectMake(120, 0, 150, 58)]; ageLabel.tag = 105; ageLabel.text = @"1985-12-29"; ageLabel.textColor = [UIColor whiteColor]; ageLabel.textAlignment = NSTextAlignmentRight; ageLabel.userInteractionEnabled = YES; UITapGestureRecognizer *tapAgeLabel = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(GetDateAction:)]; [ageLabel addGestureRecognizer:tapAgeLabel]; [self.view addSubview:ageLabel]; - (void)GetDateAction:(UITapGestureRecognizer *)tap{ NSLog(@"tap = %ld",tap.numberOfTouches); GOYearMonthDayPickerBox *box = [GOYearMonthDayPickerView yearMonthDayPickerBoxWithPickerDelegate:self];//定义视图窗口 [box.yearMonthDayPicker show];//显示 } #pragma mark - GOYearMonthDayPickerViewDelegate - (void)yearMonthDayPicker:(GOYearMonthDayPickerView *)picker selectedYear:(int)year selectedMonth:(int)month selectedDay:(int)day { UILabel *ageLabel = (UILabel *)[self.view viewWithTag:105]; ageLabel.text = [NSString stringWithFormat:@"%d-%02d-%02d",year,month,day]; }
标签:
原文地址:http://www.cnblogs.com/yyzanll/p/4323486.html