BindingTelAndThirdpartyTableViewCell.m 2.06 KB
//
//  BindingTelAndThirdpartyTableViewCell.m
//  IVTMeLiveTwo
//
//  Created by XRG on 16/8/24.
//  Copyright © 2016年 QLQ. All rights reserved.
//

#import "BindingTelAndThirdpartyTableViewCell.h"

@interface BindingTelAndThirdpartyTableViewCell ()
{
    UIImageView *headerImageView;
    UILabel *headerTitleLabel;
    UIButton *bindingButton;
}
@end

@implementation BindingTelAndThirdpartyTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        headerImageView = [[UIImageView alloc]initWithFrame:CGRectMake(16, 10, 30, 30)];
        [self.contentView addSubview:headerImageView];
        
        headerTitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(headerImageView.frame) + 5, 10, 100, 30)];
        [self.contentView addSubview:headerTitleLabel];
        
        bindingButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [bindingButton setImage:[UIImage imageNamed:@"未绑定"] forState:UIControlStateNormal];
        [bindingButton setImage:[UIImage imageNamed:@"已绑定"] forState:UIControlStateSelected];
        bindingButton.frame = CGRectMake(kScreenWidth - 76, 10, 60, 30);
        [self.contentView addSubview:bindingButton];
    }
    return self;
}

- (void)setHeaderImageName:(NSString *)headerImageName{
    _headerImageName = headerImageName;
    
    headerImageView.image = [UIImage imageNamed:_headerImageName];
}

- (void)setTitleString:(NSString *)titleString{
    _titleString = titleString;
    
    headerTitleLabel.text = _titleString;
}

- (void)setIsBinding:(BOOL)isBinding{
    _isBinding = isBinding;
    
    if (_isBinding) {
        bindingButton.selected = YES;
    }
    else{
        bindingButton.selected = NO;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end