|
|
@@ -7,11 +7,47 @@
|
|
|
//
|
|
|
|
|
|
#import "AgreementViewController.h"
|
|
|
+#import "CustomLabel.h"
|
|
|
+#import "CustomCheckBox.h"
|
|
|
+#import "CustomTableView.h"
|
|
|
+#import "WebBrowseViewController.h"
|
|
|
|
|
|
+@implementation AgreementTermTableViewCell
|
|
|
|
|
|
-@interface AgreementViewController () {
|
|
|
+- (void)didMoveToSuperview {
|
|
|
+ [_lblTitle setUnderLine:_lblTitle.text];
|
|
|
+}
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation AgreementServiceTableViewCell
|
|
|
+
|
|
|
+- (void)didMoveToSuperview {
|
|
|
+ [_lblTitle setUnderLine:_lblTitle.text];
|
|
|
+}
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation AgreementAllTableViewCell
|
|
|
+
|
|
|
+- (void)didMoveToSuperview {
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation AgreementGuideTableViewCell
|
|
|
+
|
|
|
+- (void)didMoveToSuperview {
|
|
|
+ [_lblGuide setUnderLine:_lblGuide.text];
|
|
|
+}
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@interface AgreementViewController () <CustomCheckBoxDelegate> {
|
|
|
+ NSArray *_tableZombieValues;
|
|
|
+ CustomCheckBox *_chkTerm, *_chkService, *_chkAll;
|
|
|
+}
|
|
|
@end
|
|
|
|
|
|
|
|
|
@@ -31,6 +67,9 @@
|
|
|
|
|
|
- (void)initUI {
|
|
|
|
|
|
+ _tableZombieValues = @[@"t0", @"t1", @"t2", @"t3"];
|
|
|
+
|
|
|
+ [self initTableViewAsDefaultStyle:_tableView];
|
|
|
}
|
|
|
|
|
|
- (void)prepareViewDidLoad {
|
|
|
@@ -39,10 +78,127 @@
|
|
|
|
|
|
#pragma mark - Main Logic
|
|
|
|
|
|
+#pragma mark - UITableView DataSource & Delegate
|
|
|
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
+ return 4;
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+ CGFloat height = 65;
|
|
|
+
|
|
|
+ if (indexPath.row == 2) {
|
|
|
+ height = 80;
|
|
|
+ } else if (indexPath.row == 3) {
|
|
|
+ height = 115;
|
|
|
+ }
|
|
|
+
|
|
|
+ return height;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+
|
|
|
+ UITableViewCell *cell = nil;
|
|
|
|
|
|
+ NSString *tzombie = _tableZombieValues[indexPath.row];
|
|
|
+
|
|
|
+ if (indexPath.row == 0) {
|
|
|
+ AgreementTermTableViewCell *tcell = (AgreementTermTableViewCell * )[tableView dequeueReusableCellWithIdentifier:@"TermCellIdentifier"];
|
|
|
+
|
|
|
+ if (!_chkTerm) {
|
|
|
+ _chkTerm = tcell.chkAgree;
|
|
|
+ }
|
|
|
+
|
|
|
+ tcell.chkAgree.delegate = self;
|
|
|
+ tcell.chkAgree.value = tzombie;
|
|
|
+ tcell.chkAgree.checked = [tcell.chkAgree getCheckStatusFromValue];
|
|
|
+
|
|
|
+ cell = tcell;
|
|
|
+ } else if (indexPath.row == 1) {
|
|
|
+ AgreementServiceTableViewCell *tcell = (AgreementServiceTableViewCell * )[tableView dequeueReusableCellWithIdentifier:@"ServiceCellIdentifier"];
|
|
|
+
|
|
|
+ if (!_chkService) {
|
|
|
+ _chkService = tcell.chkAgree;
|
|
|
+ }
|
|
|
+
|
|
|
+ tcell.chkAgree.delegate = self;
|
|
|
+ tcell.chkAgree.value = tzombie;
|
|
|
+ tcell.chkAgree.checked = [tcell.chkAgree getCheckStatusFromValue];
|
|
|
+
|
|
|
+ cell = tcell;
|
|
|
+ } else if (indexPath.row == 2) {
|
|
|
+ AgreementAllTableViewCell *tcell = (AgreementAllTableViewCell * )[tableView dequeueReusableCellWithIdentifier:@"AllCellIdentifier"];
|
|
|
+
|
|
|
+ if (!_chkAll) {
|
|
|
+ _chkAll = tcell.chkAgree;
|
|
|
+ }
|
|
|
+
|
|
|
+ tcell.chkAgree.delegate = self;
|
|
|
+ tcell.chkAgree.value = tzombie;
|
|
|
+ tcell.chkAgree.checked = [tcell.chkAgree getCheckStatusFromValue];
|
|
|
+
|
|
|
+ cell = tcell;
|
|
|
+ } else if (indexPath.row == 3) {//Guide
|
|
|
+ AgreementGuideTableViewCell *tcell = (AgreementGuideTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"GuideCellIdentifier"];
|
|
|
+ cell = tcell;
|
|
|
+ }
|
|
|
+
|
|
|
+ return cell;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+ [super tableView:tableView didSelectRowAtIndexPath:indexPath];
|
|
|
+
|
|
|
+ if (indexPath.row == 2 || indexPath.row == 3) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ WebBrowseViewController *vc = (WebBrowseViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"WebBrowseViewController" storyboardName:@"Common"];
|
|
|
+ if (indexPath.row == 0) {
|
|
|
+ vc.titleString = NSLocalizedString(@"서비스 이용약관", @"서비스 이용약관");
|
|
|
+ vc.URLString = [NSString stringWithFormat:@"%@/guide/service", kAPIServer];
|
|
|
+
|
|
|
+ } else if (indexPath.row == 1) {
|
|
|
+ vc.titleString = NSLocalizedString(@"개인정보 취급정책", @"개인정보 취급정책");
|
|
|
+ vc.URLString = [NSString stringWithFormat:@"%@/guide/policy", kAPIServer];
|
|
|
+ }
|
|
|
+
|
|
|
+ [self presentViewController:vc animated:YES completion:nil];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - CustomCheckBox Delegate {
|
|
|
+- (void)didCheckBoxClicked:(id)sender {
|
|
|
+
|
|
|
+ if ([sender isEqual:_chkAll]) {
|
|
|
+ _chkTerm.checked = _chkService.checked = _chkAll.checked;
|
|
|
+ } else {
|
|
|
+ if (_chkTerm.checked && _chkService.checked) {
|
|
|
+ _chkAll.checked = YES;
|
|
|
+ } else {
|
|
|
+ _chkAll.checked = NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
#pragma mark - UI Events
|
|
|
+- (IBAction)btnNextTouched:(id)sender {
|
|
|
+
|
|
|
+ if (!_chkAll.checked) {
|
|
|
+ [[JDFacade facade] toast:@"모든 약관에 동의해주세요"];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SignUpViewController" storyboardName:@"SignUp"];
|
|
|
+ [self presentViewController:vc animated:YES completion:nil];
|
|
|
+}
|
|
|
|
|
|
+- (IBAction)btnCancelTouched:(id)sender {
|
|
|
+ [self dismissViewControllerAnimated:YES completion:nil];
|
|
|
+}
|
|
|
|
|
|
|
|
|
#pragma mark - MemoryWarning
|
|
|
@@ -52,4 +208,5 @@
|
|
|
// Dispose of any resources that can be recreated.
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@end
|