//
//  AnnouncementDetailTableViewCell.m
//  RealEstateManagement
//
//  Created by Javen on 16/9/5.
//  Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//

#import "AnnouncementDetailTableViewCell.h"
#import "IBTWebViewController.h"

@implementation AnnouncementDetailTableViewCell

- (void)awakeFromNib {
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (IBAction)open:(id)sender {
    self.openFile();
}

- (void)setContentText:(NSString *)contentText {
    if (![_contentText isEqualToString:contentText]) {
        _contentText = contentText;
    }
    NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:contentText];
    NSRange contentRange = {0,[content length]};
    [content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];
    self.content.attributedText = content;
}

- (void)setType:(announcementDetailCellType)type {
    _type = type;
    switch (type) {
        case announcementDetailCellTypeTop: {
            self.topImage.hidden = NO;
            self.centerImage.hidden = YES;
            self.bottomImage.hidden = YES;
            break;
        }
        case announcementDetailCellTypeCenter: {
            self.topImage.hidden = YES;
            self.centerImage.hidden = NO;
            self.bottomImage.hidden = YES;
            break;
        }
        case announcementDetailCellTypeBottom: {
            self.topImage.hidden = YES;
            self.centerImage.hidden = YES;
            self.bottomImage.hidden = NO;
            break;
        }
    }
}

- (void)setIsOnlyOne:(BOOL)isOnlyOne {
    _isOnlyOne = isOnlyOne;
    _bottomImage.hidden = !isOnlyOne;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
