本文主要是介绍封装UIDatePicker,日期选择器,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在做日期选择中经常会用到UIDatePicker这个控件,在此简单封装了下
.h文件中
import
import “RMDateView.h”
CGFloat const kButtonHeightInDateView = 30;
CGFloat const kButtonwidthInDateView = 50;
CGFloat const kPickViewBackViewInDateView = 300;
@interface RMDateView ()
{
UIView *_backView;
}
@property (nonatomic, strong)UIDatePicker *datePicker;
@end
@implementation RMDateView
(instancetype)init
{
return [self initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) datePickerMode:UIDatePickerModeDate];
}(instancetype)initWithFrame:(CGRect)frame
datePickerMode:(UIDatePickerMode)datePickerMode
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor colorWithWhite:0.93 alpha:0.5];
[self createViewWithdatePickerMode:datePickerMode]
这篇关于封装UIDatePicker,日期选择器的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!