Skip to content

Commit

Permalink
Added custom input view attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerapong Nampetch committed Jan 15, 2016
1 parent 99404ae commit e49b12f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions MHTextField.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ typedef void(^controlBarChangedTextFieldBlock)(id, ControlBarAction);
@property (nonatomic, strong) NSDate *maximumDate;
@property (nonatomic, strong) NSDate *minimumDate;

@property (nonatomic, setter = setEmailField:) BOOL isEmailField;
@property (nonatomic, setter = setPickerField:) BOOL isPickerField;
@property (nonatomic, setter = setDateField:) BOOL isDateField;
@property (nonatomic, setter = setTimeField:) BOOL isTimeField;
@property (nonatomic, setter = setEmailField:) BOOL isEmailField;
@property (nonatomic, setter = setPickerField:) BOOL isPickerField;
@property (nonatomic, setter = setDateField:) BOOL isDateField;
@property (nonatomic, setter = setTimeField:) BOOL isTimeField;
@property (nonatomic, setter = setCustomInputView:) UIView *customInputView;
@property (nonatomic, readonly) BOOL isValid;

@property (nonatomic, strong) NSArray *pickerDatas;
Expand Down
5 changes: 4 additions & 1 deletion MHTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ - (void)setBarButtonNeedsDisplayAtTag:(NSInteger)tag{
}

- (void) selectInputView:(UITextField *)textField{
if (_isDateField || _isTimeField){
if (self.customInputView != nil) {
[textField setInputView:self.customInputView];
}
else if (_isDateField || _isTimeField){
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
if (_isDateField)
datePicker.datePickerMode = UIDatePickerModeDate;
Expand Down

0 comments on commit e49b12f

Please sign in to comment.