Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jvaeyhcd committed Oct 21, 2016
1 parent 8137e68 commit e4e2875
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion HcdDateTimePicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "HcdDateTimePicker"
s.version = "1.0.1"
s.version = "1.1.0"
s.summary = "A beautiful DateTimePicker."

# This description is used to generate tags and improve search results.
Expand Down
3 changes: 3 additions & 0 deletions HcdDateTimePicker/HcdDateTimePickerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ typedef void(^ClickedOkBtn)(NSString *dateTimeStr);
@property (nonatomic,assign) NSInteger maxYear;
@property (nonatomic,assign) NSInteger minYear;

@property (nonatomic,assign) UIColor *topViewColor;
@property (nonatomic,assign) UIColor *buttonTitleColor;

-(instancetype)initWithDefaultDatetime:(NSDate*)dateTime;
-(instancetype)initWithDatePickerMode:(DatePickerMode)datePickerMode defaultDateTime:(NSDate*)dateTime;
-(void) showHcdDateTimePicker;
Expand Down
30 changes: 27 additions & 3 deletions HcdDateTimePicker/HcdDateTimePickerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ - (instancetype)initWithDefaultDatetime:(NSDate *)dateTime
self.defaultDate = [NSDate date];
}
self.datePickerMode = DatePickerDateTimeMode;
[self initDatas];
[self setTimeBroadcastView];
}
return self;
Expand All @@ -78,6 +79,7 @@ - (instancetype)initWithDatePickerMode:(DatePickerMode)datePickerMode defaultDat
self.defaultDate = [NSDate date];
}
self.datePickerMode = datePickerMode;
[self initDatas];
[self setTimeBroadcastView];
}
return self;
Expand Down Expand Up @@ -108,6 +110,28 @@ - (void)drawRect:(CGRect)rect
}
*/

- (void)initDatas {
_topViewColor = [UIColor colorWithHexString:@"0x6271f3"];
_buttonTitleColor = [UIColor colorWithHexString:@"0xffffff"];
}

- (void)setTopViewColor:(UIColor *)topViewColor {
_topViewColor = topViewColor;
if (topView) {
topView.backgroundColor = topViewColor;
}
}

- (void)setButtonTitleColor:(UIColor *)buttonTitleColor {
_buttonTitleColor = buttonTitleColor;
if (okBtn) {
[okBtn setTitleColor:_buttonTitleColor forState:UIControlStateNormal];
}
if (cancleBtn) {
[cancleBtn setTitleColor:_buttonTitleColor forState:UIControlStateNormal];
}
}

#pragma mark -custompicker
//设置自定义datepicker界面
- (void)setTimeBroadcastView
Expand All @@ -121,21 +145,21 @@ - (void)setTimeBroadcastView
dateTimeStr = [dateFormatter stringFromDate:self.defaultDate];

topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreen_Width, kTopViewHeight)];
topView.backgroundColor = [UIColor colorWithHexString:@"0x6271f3"];
topView.backgroundColor = _topViewColor;

okBtn = [[UIButton alloc]initWithFrame:CGRectMake(kScreen_Width-60, 0, 60, kTopViewHeight)];
[okBtn setTitleColor:_buttonTitleColor forState:UIControlStateNormal];
okBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[okBtn setBackgroundColor:[UIColor clearColor]];
[okBtn setTitleColor:[UIColor colorWithHexString:@"0xffffff"] forState:UIControlStateNormal];
[okBtn setTitle:@"确定" forState:UIControlStateNormal];
[okBtn addTarget:self action:@selector(selectedButtons:) forControlEvents:UIControlEventTouchUpInside];
okBtn.tag = kOKBtnTag;
[self addSubview:okBtn];

cancleBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 60, kTopViewHeight)];
cancleBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[cancleBtn setTitleColor:_buttonTitleColor forState:UIControlStateNormal];
[cancleBtn setBackgroundColor:[UIColor clearColor]];
[cancleBtn setTitleColor:[UIColor colorWithHexString:@"0xffffff"] forState:UIControlStateNormal];
[cancleBtn setTitle:@"取消" forState:UIControlStateNormal];
[cancleBtn addTarget:self action:@selector(selectedButtons:) forControlEvents:UIControlEventTouchUpInside];
cancleBtn.tag = kCancleBtnTag;
Expand Down

0 comments on commit e4e2875

Please sign in to comment.