KWMAddressCell.m 1.34 KB
Newer Older
houweibin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
//
//  KWMAddressView.m
//  iCemarose
//
//  Created by HouWeiBin on 16/9/2.
//  Copyright © 2016年 kollway. All rights reserved.
//

#import "KWMAddressCell.h"

@implementation KWMAddressCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

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

}

- (void)setAddress:(BUYAddress *)address{
    if (address) {
        _address = address;
        _lbName.text = address.lastName;
        _lbPhone.text = address.phone;
        if(address.province != nil){
            _lbAddress.text = [NSString stringWithFormat:@"%@, %@",address.city,address.province];
        }else{
            _lbAddress.text = address.city;
        }
        _lbAddressDetail.text = [NSString stringWithFormat:@"%@  %@",address.address1,address.address2 == nil?@"":address.address2];
    }
}

-(void)setData:(BOOL)isShowEdit{
    if(isShowEdit){
        self.btnEdit.hidden = NO;
        self.btnDelete.hidden = NO;
    }else{
        self.btnEdit.hidden = YES;
        self.btnDelete.hidden = YES;
    }
}

- (IBAction)onClickDelete:(id)sender {
    if (self.delegate != nil) {
        [self.delegate kwm_onClickDeleteBtnWith:_address];
    }
}

- (IBAction)onClickEdit:(id)sender {
    if (self.delegate != nil) {
        [self.delegate kwm_onClickEditBtnWith:_address];
    }
}

@end