// // SettingsViewController.m // kneet // // Created by Jason Lee on 5/13/15. // Copyright (c) 2015 ntels. All rights reserved. // #import "JDObject.h" #import "SettingsViewController.h" #import "WebBrowseViewController.h" #import "CustomLabel.h" @interface SettingsViewController () { UIImage *_bgCellImage1, *_bgCellImage2; } @end #pragma mark - Class Definition @implementation SettingsViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self initUI]; [self prepareViewDidLoad]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.title = NSLocalizedString(@"설정",nil); } - (void)initUI { //set tableview option self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.backgroundColor = [UIColor clearColor]; self.tableView.tableFooterView = [[UIView alloc] init]; //this call table events; UIEdgeInsets insets = UIEdgeInsetsMake(4, 4, 4, 4); _bgCellImage1 = [CommonUtil resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch img:[UIImage imageNamed:@"tp_01_img_list_bg_02"]]; _bgCellImage2 = [CommonUtil resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch img:[UIImage imageNamed:@"tp_01_img_list_bg_01"]]; //Localization _lblAccount.text = NSLocalizedString(@"계정 정보", @"계정 정보"); _lblMobile.text = NSLocalizedString(@"단말 관리", @"단말 관리"); _lblHome.text = NSLocalizedString(@"홈 관리", @"홈 관리"); _lblService.text = NSLocalizedString(@"서비스 안내", @"서비스 안내"); _lblApp.text = NSLocalizedString(@"앱 정보", @"앱 정보"); } - (void)prepareViewDidLoad { } #pragma mark - Main Logic #pragma mark - UITableView DataSource & Delegate - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone; //set background image if (indexPath.row % 2 == 1) { cell.backgroundView = [[UIImageView alloc] initWithImage:_bgCellImage1]; } else { cell.backgroundView = [[UIImageView alloc] initWithImage:_bgCellImage2]; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; UIViewController *vc = nil; switch (indexPath.row) { case 0: vc = [CommonUtil instantiateViewControllerWithIdentifier:@"AccountViewController" storyboardName:@"Settings"]; break; case 1: vc = [CommonUtil instantiateViewControllerWithIdentifier:@"MobilesViewController" storyboardName:@"Settings"]; break; case 2: vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeListViewController" storyboardName:@"Settings"]; break; case 3: vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ServiceViewController" storyboardName:@"Settings"]; break; case 4: vc = [CommonUtil instantiateViewControllerWithIdentifier:@"AppInfoViewController" storyboardName:@"Settings"]; break; } [self.navigationController pushViewController:vc animated:YES]; } - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { // Remove seperator inset if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } // Prevent the cell from inheriting the Table View's margin settings if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) { [cell setPreservesSuperviewLayoutMargins:NO]; } // Explictly set your cell's layout margins if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } } #pragma mark - UI Events #pragma mark - MemoryWarning - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end