//
//  JDViewController.m
//  kneet2
//
//  Created by Created by Jason Lee on 10/1/15.
//  Copyright (c) 2015 ntels. All rights reserved.
//

#import "JDViewController.h"
#import "CustomTableView.h"


@interface JDViewController () {
    //groups, invite from sms,
}
@end


#pragma mark - Class Definition

@implementation JDViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self initUIOnSuper];
    [self prepareViewDidLoadOnSuper];
}


- (void)initUIOnSuper {

}

- (void)prepareViewDidLoadOnSuper {
    
}


- (UIButton *)generateOptionButton {
    UIImage *image = [UIImage imageNamed:@"common_head_btn_more"];
    UIImage *imagePress = [UIImage imageNamed:@"common_head_btn_more_press"];
    CGRect btnFrame = CGRectMake(0, 0, image.size.width, image.size.height);
    
    UIButton *button = [[UIButton alloc] initWithFrame:btnFrame];
    button.tag = 9003;
    
    [button setImage:image forState:UIControlStateNormal];
    [button setImage:imagePress forState:UIControlStateHighlighted];
    [button addTarget:self action:@selector(toggleOption:) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.navigationItem.rightBarButtonItem = item;
    return button;
}

- (void)toggleOption:(id)sender {
    
}

#pragma mark - Main Logic


#pragma mark - UITableView DataSource & Delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath 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
