//
//  AddressBookCell.m
//  IHKApp
//
//  Created by 郑文明 on 15/4/23.
//  Copyright (c) 2015年 www.ihk.cn. All rights reserved.
//

#import "AddressBookCell.h"

@implementation AddressBookCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.photoIV.clipsToBounds = YES;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}
- (IBAction)selBtnClick:(UIButton *)sender {
    sender.selected = !sender.selected;
    self.frendModel.isSelected = sender.selected;
    if (self.selBlock) {
        self.selBlock();
    }
}

-(void)setFrendModel:(SLFriendsModel *)frendModel{
    _frendModel = frendModel;
    self.nameLabel.text = frendModel.userName;
    self.imgLeftConst.constant = -24;
    if (frendModel.isEdit) {
        self.imgLeftConst.constant = 16;
        self.selBtn.selected = frendModel.isSelected;
    }
    NSString *userImg = [frendModel getUserHeadUrl];
    [self.photoIV sd_setImageWithURL:[NSURL URLWithString:userImg] placeholderImage:[UIImage imageNamed:@"icon_ellipse"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        
    }];
}

- (void)confignCellWith:(SLUserModel *)userModel {
    self.nameLabel.text = userModel.userName;
    NSString *userImg = [userModel getUserHeadUrl];
    [self.photoIV sd_setImageWithURL:[NSURL URLWithString:userImg] placeholderImage:[UIImage imageNamed:@"icon_ellipse"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        
    }];
}

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

    // Configure the view for the selected state
}

@end
