DateSelectPopupView.m 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 "DateSelectPopupView.h"
  13. @interface DateSelectPopupView () <CustomTextFieldDelegate>
  14. {
  15. }
  16. @end
  17. @implementation DateSelectPopupView
  18. - (id)initFromNib {
  19. for (UIView *view in [CommonUtil nibViews:@"DateSelectPopupView"]) {
  20. if ([view isKindOfClass:[DateSelectPopupView class]]) {
  21. self = (DateSelectPopupView *)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. }
  43. }
  44. return self;
  45. }
  46. - (void)didMoveToSuperview {
  47. if (!self.superview) {
  48. return;
  49. }
  50. // _txtYear.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
  51. // _txtMonth.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
  52. // _txtDay.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
  53. }
  54. - (void)btnConfirmTouched:(id)sender {
  55. NSLog(@"확인");
  56. }
  57. #pragma mark - CustomTextField
  58. - (BOOL)textFieldShouldReturn:(UITextField *)textField {
  59. // if ([textField isEqual:_txtDay]) {
  60. // [self btnConfirmTouched:nil];
  61. // }
  62. // if ([textField isEqual:_txtMonth]) {
  63. // [_txtDay becomeFirstResponder];
  64. // }
  65. // if ([textField isEqual:_txtYear]) {
  66. // [_txtMonth becomeFirstResponder];
  67. // }
  68. return YES;
  69. }
  70. @end