InvitationAnswerPopupView.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // InvitationAnswerPopupView
  3. // kneet
  4. //
  5. // Created by Jason Lee on 6/15/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. #import "JDObject.h"
  9. #import "CustomLabel.h"
  10. #import "CustomCheckBox.h"
  11. #import "InvitationAnswerPopupView.h"
  12. #import "LoginModel.h"
  13. #import "DatePickerButton.h"
  14. @interface InvitationAnswerPopupView () {
  15. }
  16. @end
  17. @implementation InvitationAnswerPopupView
  18. - (id)initFromNib {
  19. for (UIView *view in [CommonUtil nibViews:@"InvitationAnswerPopupView"]) {
  20. if ([view isKindOfClass:[InvitationAnswerPopupView class]]) {
  21. self = (InvitationAnswerPopupView *)view;
  22. //XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
  23. self.frame = [UIScreen mainScreen].bounds;
  24. self.lblTitle.text = NSLocalizedString(@"멤버 인증퀴즈", @"멤버 인증퀴즈");
  25. _btnDate.date = [NSDate date];
  26. _btnDate.placeHolder = _btnDate.dateString;
  27. [self.btnConfirm setTitle:NSLocalizedString(@"확인", @"확인") forState:UIControlStateNormal];
  28. [self.btnCancel setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
  29. }
  30. }
  31. return self;
  32. }
  33. - (void)didMoveToSuperview {
  34. }
  35. - (void)setInvitation:(InvitationModel *)invitation {
  36. _invitation = invitation;
  37. // 22, 16
  38. // 18, 13 f
  39. //1. title height
  40. NSString *desc = [NSString stringWithFormat:NSLocalizedString(@"퀴즈를 맞춰서 [%@]의 홈 멤버가 되세요", @"퀴즈를 맞춰서 [%@]의 홈 멤버가 되세요"), _invitation.homegrpName];
  41. NSString *quiz = [NSString stringWithFormat:@"\"%@\"", _invitation.authorizationQuestion];
  42. CGFloat width = IPHONE_WIDTH - 62; //258
  43. CustomLabel *lblTemp = [[CustomLabel alloc] initWithFrame:CGRectMake(0, 0, width, 16)];
  44. lblTemp.font = [UIFont systemFontOfSize:kUIFontSize04];
  45. lblTemp.numberOfLines = 0;
  46. CGFloat adjustHeight = [CommonUtil getSizeFromString:desc font:lblTemp.font width:width].height;
  47. adjustHeight = adjustHeight < 16 ? 0 : adjustHeight - 16;
  48. CustomLabel *lblTemp2 = [[CustomLabel alloc] initWithFrame:CGRectMake(0, 0, width, 22)];
  49. lblTemp2.font = [UIFont systemFontOfSize:kUIFontSize05];
  50. lblTemp2.numberOfLines = 0;
  51. CGFloat adjustHeight2 = [CommonUtil getSizeFromString:quiz font:lblTemp2.font width:width].height;
  52. adjustHeight2 = adjustHeight2 < 22 ? 0 : adjustHeight2 - 22;
  53. _lblDesc.text = desc;
  54. _lblQuiz.text = quiz;
  55. }
  56. - (NSString *)selectedDate {
  57. return _btnDate.dateString ? _btnDate.dateString : ksEmptyString;
  58. }
  59. - (void)btnConfirmTouched:(id)sender {
  60. //validate
  61. if (!_btnDate.date) {
  62. [[JDFacade facade] alert:NSLocalizedString(@"날짜를 선택해주세요", @"날짜를 선택해주세요")];
  63. return;
  64. }
  65. [super btnConfirmTouched:sender];
  66. }
  67. @end