// // HomeHubViewController.m // kneet2 // // Created by Jason Lee on 10/28/15. // Copyright © 2015 ntels. All rights reserved. // #import "HomeHubViewController.h" #import "RequestHandler.h" #import "DeviceModel.h" #import "CustomTableView.h" @implementation HomeHubTableViewCell @end @implementation HomeHubRegistTableViewCell @end @interface HomeHubViewController () { } @end #pragma mark - Class Definition @implementation HomeHubViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self initUI]; [self prepareViewDidLoad]; } - (void)initUI { [self initTableViewAsDefaultStyle:_tableView]; } - (void)prepareViewDidLoad { } - (void)updateHomeHubStatus { [_tableView reloadData]; } #pragma mark - UITableView DataSource & Delegate - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 2; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { CGFloat height = 86.0f; if (indexPath.row == 0) { height = 101.0f; } return height; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = nil; if (indexPath.row == 0) { HomeHubTableViewCell *tcell = (HomeHubTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"HubCellIdentifier"]; if ([JDFacade facade].loginUser.isHomehubOnline) { tcell.lblStatus.text = @"온라인"; tcell.imgvStatus.image = [UIImage imageNamed:@"img_homehub_icon_online"]; } else { tcell.lblStatus.text = @"오프라인"; tcell.imgvStatus.image = [UIImage imageNamed:@"img_homehub_icon_offline"]; } cell = tcell; } else if (indexPath.row == 1) { HomeHubRegistTableViewCell *tcell = (HomeHubRegistTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"RegistCellIdentifier"]; tcell.lblDate.text = [CommonUtil formattedDate3:[JDFacade facade].loginUser.homehubCreateDatetime]; cell = tcell; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [super tableView:tableView didSelectRowAtIndexPath:indexPath]; } #pragma mark - UI Events - (IBAction)btnSecureTouched:(id)sender { } - (void)btnCloseTouched:(id)sender { [self dismissViewControllerAnimated:YES completion:nil]; } #pragma mark - MemoryWarning - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end