|
|
@@ -9,7 +9,7 @@
|
|
|
#import "JDObject.h"
|
|
|
#import "CustomLabel.h"
|
|
|
#import "CustomButton.h"
|
|
|
-#import "CustomTextField.h"
|
|
|
+
|
|
|
#import "CustomDatePopupView.h"
|
|
|
|
|
|
@interface CustomDatePopupView () <CustomTextFieldDelegate>
|
|
|
@@ -21,6 +21,13 @@
|
|
|
|
|
|
@implementation CustomDatePopupView
|
|
|
|
|
|
+- (id)initWithTitle:(NSString *)title
|
|
|
+{
|
|
|
+ [self setTitle:title];
|
|
|
+
|
|
|
+ return [self initFromNib];
|
|
|
+}
|
|
|
+
|
|
|
- (id)initFromNib {
|
|
|
for (UIView *view in [CommonUtil nibViews:@"CustomDatePopupView"]) {
|
|
|
if ([view isKindOfClass:[CustomDatePopupView class]]) {
|
|
|
@@ -29,17 +36,17 @@
|
|
|
//XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
|
|
|
self.frame = [UIScreen mainScreen].bounds;
|
|
|
|
|
|
-// _txtYear.delegate = self;
|
|
|
-// _txtYear.keyboardType = UIKeyboardTypePhonePad;
|
|
|
-// _txtYear.returnKeyType = UIReturnKeyNext;
|
|
|
-//
|
|
|
-// _txtMonth.delegate = self;
|
|
|
-// _txtMonth.keyboardType = UIKeyboardTypePhonePad;
|
|
|
-// _txtMonth.returnKeyType = UIReturnKeyNext;
|
|
|
-//
|
|
|
-// _txtDay.delegate = self;
|
|
|
-// _txtMonth.keyboardType = UIKeyboardTypePhonePad;
|
|
|
-// _txtMonth.returnKeyType = UIReturnKeyDone;
|
|
|
+ _txtYear.delegate = self;
|
|
|
+ _txtYear.keyboardType = UIKeyboardTypeNumberPad;
|
|
|
+ _txtYear.returnKeyType = UIReturnKeyNext;
|
|
|
+
|
|
|
+ _txtMonth.delegate = self;
|
|
|
+ _txtMonth.keyboardType = UIKeyboardTypeNumberPad;
|
|
|
+ _txtMonth.returnKeyType = UIReturnKeyNext;
|
|
|
+
|
|
|
+ _txtDay.delegate = self;
|
|
|
+ _txtDay.keyboardType = UIKeyboardTypeNumberPad;
|
|
|
+ _txtDay.returnKeyType = UIReturnKeyDone;
|
|
|
|
|
|
[self.imgTitleBar setImage:[UIImage imageNamed:@"img_popup_bg_head"]inset:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
|
|
|
|
|
|
@@ -69,28 +76,46 @@
|
|
|
if (!self.superview) {
|
|
|
return;
|
|
|
}
|
|
|
-// _txtYear.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
|
|
|
-// _txtMonth.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
|
|
|
-// _txtDay.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
|
|
|
+ _txtYear.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
|
|
|
+ _txtMonth.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
|
|
|
+ _txtDay.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
|
|
|
}
|
|
|
|
|
|
-- (void)btnConfirmTouched:(id)sender {
|
|
|
+- (IBAction)btnConfirmTouched:(id)sender {
|
|
|
|
|
|
- NSLog(@"확인");
|
|
|
+// NSLog(@"확인");
|
|
|
+ [super btnConfirmTouched:sender];
|
|
|
}
|
|
|
|
|
|
#pragma mark - CustomTextField
|
|
|
|
|
|
+
|
|
|
+
|
|
|
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
|
|
-// if ([textField isEqual:_txtDay]) {
|
|
|
-// [self btnConfirmTouched:nil];
|
|
|
-// }
|
|
|
-// if ([textField isEqual:_txtMonth]) {
|
|
|
-// [_txtDay becomeFirstResponder];
|
|
|
-// }
|
|
|
-// if ([textField isEqual:_txtYear]) {
|
|
|
-// [_txtMonth becomeFirstResponder];
|
|
|
-// }
|
|
|
+ if ([textField isEqual:_txtDay]) {
|
|
|
+ [self btnConfirmTouched:nil];
|
|
|
+ }
|
|
|
+ if ([textField isEqual:_txtMonth]) {
|
|
|
+ [_txtDay becomeFirstResponder];
|
|
|
+ }
|
|
|
+ if ([textField isEqual:_txtYear]) {
|
|
|
+ [_txtMonth becomeFirstResponder];
|
|
|
+ }
|
|
|
+ return YES;
|
|
|
+}
|
|
|
+
|
|
|
+- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
|
|
+ if ([textField isEqual:_txtYear]) {
|
|
|
+ if (textField.text.length >= 4 && range.length == 0) {
|
|
|
+ return NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (textField.text.length >= 2 && range.length == 0) {
|
|
|
+ return NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
return YES;
|
|
|
}
|
|
|
+
|
|
|
@end
|