SettingsViewController.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //
  2. // SettingsViewController.m
  3. // kneet
  4. //
  5. // Created by Jason Lee on 5/13/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. #import "JDObject.h"
  9. #import "SettingsViewController.h"
  10. #import "WebBrowseViewController.h"
  11. #import "CustomLabel.h"
  12. @interface SettingsViewController () {
  13. UIImage *_bgCellImage1, *_bgCellImage2;
  14. }
  15. @end
  16. #pragma mark - Class Definition
  17. @implementation SettingsViewController
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. // Do any additional setup after loading the view.
  21. [self initUI];
  22. [self prepareViewDidLoad];
  23. }
  24. - (void)viewWillAppear:(BOOL)animated {
  25. [super viewWillAppear:animated];
  26. self.title = NSLocalizedString(@"설정",nil);
  27. }
  28. - (void)initUI {
  29. //set tableview option
  30. self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  31. self.tableView.backgroundColor = [UIColor clearColor];
  32. self.tableView.tableFooterView = [[UIView alloc] init]; //this call table events;
  33. UIEdgeInsets insets = UIEdgeInsetsMake(4, 4, 4, 4);
  34. _bgCellImage1 = [CommonUtil resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch img:[UIImage imageNamed:@"tp_01_img_list_bg_02"]];
  35. _bgCellImage2 = [CommonUtil resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch img:[UIImage imageNamed:@"tp_01_img_list_bg_01"]];
  36. //Localization
  37. _lblAccount.text = NSLocalizedString(@"계정 정보", @"계정 정보");
  38. _lblMobile.text = NSLocalizedString(@"단말 관리", @"단말 관리");
  39. _lblHome.text = NSLocalizedString(@"홈 관리", @"홈 관리");
  40. _lblService.text = NSLocalizedString(@"서비스 안내", @"서비스 안내");
  41. _lblApp.text = NSLocalizedString(@"앱 정보", @"앱 정보");
  42. }
  43. - (void)prepareViewDidLoad {
  44. }
  45. #pragma mark - Main Logic
  46. #pragma mark - UITableView DataSource & Delegate
  47. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  48. UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
  49. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  50. //set background image
  51. if (indexPath.row % 2 == 1) {
  52. cell.backgroundView = [[UIImageView alloc] initWithImage:_bgCellImage1];
  53. } else {
  54. cell.backgroundView = [[UIImageView alloc] initWithImage:_bgCellImage2];
  55. }
  56. return cell;
  57. }
  58. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  59. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  60. UIViewController *vc = nil;
  61. switch (indexPath.row) {
  62. case 0:
  63. vc = [CommonUtil instantiateViewControllerWithIdentifier:@"AccountViewController" storyboardName:@"Settings"];
  64. break;
  65. case 1:
  66. vc = [CommonUtil instantiateViewControllerWithIdentifier:@"MobilesViewController" storyboardName:@"Settings"];
  67. break;
  68. case 2:
  69. vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeListViewController" storyboardName:@"Settings"];
  70. break;
  71. case 3:
  72. vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ServiceViewController" storyboardName:@"Settings"];
  73. break;
  74. case 4:
  75. vc = [CommonUtil instantiateViewControllerWithIdentifier:@"AppInfoViewController" storyboardName:@"Settings"];
  76. break;
  77. }
  78. [self.navigationController pushViewController:vc animated:YES];
  79. }
  80. - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
  81. // Remove seperator inset
  82. if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
  83. [cell setSeparatorInset:UIEdgeInsetsZero];
  84. }
  85. // Prevent the cell from inheriting the Table View's margin settings
  86. if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
  87. [cell setPreservesSuperviewLayoutMargins:NO];
  88. }
  89. // Explictly set your cell's layout margins
  90. if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
  91. [cell setLayoutMargins:UIEdgeInsetsZero];
  92. }
  93. }
  94. #pragma mark - UI Events
  95. #pragma mark - MemoryWarning
  96. - (void)didReceiveMemoryWarning
  97. {
  98. [super didReceiveMemoryWarning];
  99. // Dispose of any resources that can be recreated.
  100. }
  101. @end