可修改文字颜色和限制最大日期的时间选择器使用示例

网友投稿 732 2022-11-27

可修改文字颜色和限制最大日期的时间选择器使用示例

可修改文字颜色和限制最大日期的时间选择器使用示例

可修改文字颜色和限制最大日期的时间选择器使用示例。​​​PGDatePicker.zip​​​。 使用代码

@interface CBPHealthCareViewController ()

*datePickManager = [[PGDatePickManager alloc]init]; datePickManager.confirmButtonTextColor = BGColorHex(FF7648); datePickManager.cancelButtonTextColor = BGColorHex(CCCCC); datePickManager.headerViewBackgroundColor = BGColorHex(F0F0F0); datePickManager.isShadeBackground = true; PGDatePicker *datePicker = datePickManager.datePicker; datePicker.textColorOfSelectedRow = BGColorHex(FF7648); datePicker.lineBackgroundColor = BGColorHex(FF7648); datePicker.delegate = self; datePicker.datePickerType = PGDatePickerTypeVertical; datePicker.isHiddenMiddleText = false; // datePicker.isCycleScroll = true; datePicker.datePickerMode = PGDatePickerModeDate; long long nowTime = (long long)([[NSDate date] timeIntervalSince1970]*1000+[[BITSingleObject sharedInstance] getZoneTimeDifference])+[BITSingleObject sharedInstance].localServerDifferenceTime-24*3600*1000-8*3600*1000; datePicker.maximumDate = [NSDate dateWithTimeIntervalSince1970:nowTime/1000]; datePicker.originDate = [NSDate dateWithTimeIntervalSince1970:nowTime/1000]; [self presentViewController:datePickManager animated:false completion:nil];

#pragma- (void)datePicker:(PGDatePicker *)datePicker didSelectDate:(NSDateComponents *)dateComponents { NSString *date_time = [NSString stringWithFormat:@"%d-%d-%d", dateComponents.year,dateComponents.month,dateComponents.day]; // 日期格式化类 NSDateFormatter *fmt = [[NSDateFormatter alloc] init]; // 设置日期格式(为了转换成功) fmt.dateFormat = @"yyyy-MM-dd"; // NSString * -> NSDate * NSDate *date = [fmt dateFromString:date_time]; NSDateFormatter *dateFmt = [[NSDateFormatter alloc]init]; dateFmt.dateFormat = @"yyyy-MM-dd"; self.model.thirdHealthCareEntity.date_time = [dateFmt stringFromDate:date]; NSLog(@"dateComponents = %@, self.model.thirdHealthCareEntity.date_time:%@", dateComponents, self.model.thirdHealthCareEntity.date_time); self.healthCareSelectTool.model = self.model.thirdHealthCareEntity; self.model.status = GBCommonStatusThird; self.model.page = 1; self.model.thirdHealthCareEntity.is_old = YES; [self excuteParent_health_listCommand];}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:如何访问组件的bundle资源
下一篇:在viewWillAppear函数中禁止左滑,viewWillDisappear开启左滑动产生进入下一个页面来回滑动造成无法点击点击按钮问题
相关文章

 发表评论

暂时没有评论,来抢沙发吧~