HomeHubViewController.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. //
  2. // HomeHubViewController.m
  3. // kneet2
  4. //
  5. // Created by Jason Lee on 10/28/15.
  6. // Copyright © 2015 ntels. All rights reserved.
  7. //
  8. #import "HomeHubViewController.h"
  9. #import "RequestHandler.h"
  10. #import "DeviceModel.h"
  11. #import "CustomTableView.h"
  12. @implementation HomeHubTableViewCell
  13. @end
  14. @implementation HomeHubRegistTableViewCell
  15. @end
  16. @interface HomeHubViewController () {
  17. }
  18. @end
  19. #pragma mark - Class Definition
  20. @implementation HomeHubViewController
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. // Do any additional setup after loading the view.
  24. [self initUI];
  25. [self prepareViewDidLoad];
  26. }
  27. - (void)initUI {
  28. [self initTableViewAsDefaultStyle:_tableView];
  29. }
  30. - (void)prepareViewDidLoad {
  31. }
  32. - (void)updateHomeHubStatus {
  33. [_tableView reloadData];
  34. }
  35. #pragma mark - UITableView DataSource & Delegate
  36. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  37. return 1;
  38. }
  39. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  40. return 2;
  41. }
  42. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  43. CGFloat height = 86.0f;
  44. if (indexPath.row == 0) {
  45. height = 101.0f;
  46. }
  47. return height;
  48. }
  49. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  50. UITableViewCell *cell = nil;
  51. if (indexPath.row == 0) {
  52. HomeHubTableViewCell *tcell = (HomeHubTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"HubCellIdentifier"];
  53. if ([JDFacade facade].loginUser.isHomehubOnline) {
  54. tcell.lblStatus.text = @"온라인";
  55. tcell.imgvStatus.image = [UIImage imageNamed:@"img_homehub_icon_online"];
  56. } else {
  57. tcell.lblStatus.text = @"오프라인";
  58. tcell.imgvStatus.image = [UIImage imageNamed:@"img_homehub_icon_offline"];
  59. }
  60. cell = tcell;
  61. } else if (indexPath.row == 1) {
  62. HomeHubRegistTableViewCell *tcell = (HomeHubRegistTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"RegistCellIdentifier"];
  63. tcell.lblDate.text = [CommonUtil formattedDate3:[JDFacade facade].loginUser.homehubCreateDatetime];
  64. cell = tcell;
  65. }
  66. return cell;
  67. }
  68. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  69. [super tableView:tableView didSelectRowAtIndexPath:indexPath];
  70. }
  71. #pragma mark - UI Events
  72. - (IBAction)btnSecureTouched:(id)sender {
  73. }
  74. - (void)btnCloseTouched:(id)sender {
  75. [self dismissViewControllerAnimated:YES completion:nil];
  76. }
  77. #pragma mark - MemoryWarning
  78. - (void)didReceiveMemoryWarning
  79. {
  80. [super didReceiveMemoryWarning];
  81. // Dispose of any resources that can be recreated.
  82. }
  83. @end