CustomDatePopupView.m 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // DateSelectPopupView.m
  3. // OneCable
  4. //
  5. // Created by nComz on 2017. 4. 11..
  6. // Copyright © 2017년 ntels. All rights reserved.
  7. //
  8. #import "JDObject.h"
  9. #import "CustomLabel.h"
  10. #import "CustomButton.h"
  11. #import "CustomTextField.h"
  12. #import "CustomDatePopupView.h"
  13. @interface CustomDatePopupView () <CustomTextFieldDelegate>
  14. {
  15. }
  16. @end
  17. @implementation CustomDatePopupView
  18. - (id)initFromNib {
  19. for (UIView *view in [CommonUtil nibViews:@"CustomDatePopupView"]) {
  20. if ([view isKindOfClass:[CustomDatePopupView class]]) {
  21. self = (CustomDatePopupView *)view;
  22. //XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
  23. self.frame = [UIScreen mainScreen].bounds;
  24. // _txtYear.delegate = self;
  25. // _txtYear.keyboardType = UIKeyboardTypePhonePad;
  26. // _txtYear.returnKeyType = UIReturnKeyNext;
  27. //
  28. // _txtMonth.delegate = self;
  29. // _txtMonth.keyboardType = UIKeyboardTypePhonePad;
  30. // _txtMonth.returnKeyType = UIReturnKeyNext;
  31. //
  32. // _txtDay.delegate = self;
  33. // _txtMonth.keyboardType = UIKeyboardTypePhonePad;
  34. // _txtMonth.returnKeyType = UIReturnKeyDone;
  35. [self.imgTitleBar setImage:[UIImage imageNamed:@"img_popup_bg_head"]inset:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  36. [self.btnConfirm setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_right"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  37. [self.btnConfirm setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_right_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  38. [self.btnCancel setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_left"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  39. [self.btnCancel setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_left_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  40. [self.btnConfirm setTitle:NSLocalizedString(@"확인", @"확인") forState:UIControlStateNormal];
  41. [self.btnCancel setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
  42. [self setTitle:@"정답 날짜 입력"];
  43. }
  44. }
  45. return self;
  46. }
  47. - (void)setTitle:(NSString *)title {
  48. self.lblTitle.text = title;
  49. }
  50. - (void)didMoveToSuperview {
  51. if (!self.superview) {
  52. return;
  53. }
  54. // _txtYear.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
  55. // _txtMonth.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
  56. // _txtDay.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
  57. }
  58. - (void)btnConfirmTouched:(id)sender {
  59. NSLog(@"확인");
  60. }
  61. #pragma mark - CustomTextField
  62. - (BOOL)textFieldShouldReturn:(UITextField *)textField {
  63. // if ([textField isEqual:_txtDay]) {
  64. // [self btnConfirmTouched:nil];
  65. // }
  66. // if ([textField isEqual:_txtMonth]) {
  67. // [_txtDay becomeFirstResponder];
  68. // }
  69. // if ([textField isEqual:_txtYear]) {
  70. // [_txtMonth becomeFirstResponder];
  71. // }
  72. return YES;
  73. }
  74. @end