






#import "AskNormalTenCell.h"
#import "ScrollDatum.h"
#import "Masonry.h"
#import "UIImage+SeeImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+ExitsTask.h"

@interface AskNormalTenCell()


@property (nonatomic,strong) NSString * spaOwnOutView;


@property (nonatomic,strong) UIImageView * blinkFloorView;


@property (nonatomic,strong) UILabel * mixCursiveLabel;


@property (nonatomic,strong) UILabel * pauseFunkLabel;

@property (nonatomic, strong) UIButton * sawTenButton;

@end

@implementation AskNormalTenCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = ScrollDatum.tildeStopHit.gainLossSay;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.blinkFloorView = [UIImageView new];
        self.blinkFloorView.tintColor = [ScrollDatum cinematicColor];
        self.blinkFloorView.layer.cornerRadius = ScrollDatum.tildeStopHit.kinTextBezel;
        [self.contentView addSubview:self.blinkFloorView];
        [self.blinkFloorView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(ScrollDatum.tildeStopHit.andBloodNow);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(ScrollDatum.tildeStopHit.ownArmourBit);
        }];
        
        self.mixCursiveLabel = [UILabel new];
        self.mixCursiveLabel.font = [UIFont boldSystemFontOfSize:ScrollDatum.tildeStopHit.jouleEggMild];
        self.mixCursiveLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.mixCursiveLabel];
        
        self.pauseFunkLabel = [UILabel new];
        self.pauseFunkLabel.font = [UIFont boldSystemFontOfSize:ScrollDatum.tildeStopHit.waxMenWatery];
        self.pauseFunkLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.pauseFunkLabel];
        
        [self.mixCursiveLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.blinkFloorView.mas_right).offset(ScrollDatum.tildeStopHit.fireFootnote);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.pauseFunkLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mixCursiveLabel);
            make.top.equalTo(self.mixCursiveLabel.mas_bottom).offset(ScrollDatum.tildeStopHit.weekendRoot);
        }];
        
        self.sawTenButton = [[UIButton alloc] init];
        _sawTenButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage broadcastExtractFlushedTopSentName:ScrollDatum.tildeStopHit.ourFaxLowSubfamilyTen] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_sawTenButton setBackgroundImage:[UIImage broadcastExtractFlushedTopSentName:ScrollDatum.tildeStopHit.transformProvidesPrefixGenerateArea] forState: UIControlStateNormal];
        [_sawTenButton setBackgroundImage:image forState: UIControlStateSelected];
        _sawTenButton.tintColor = [ScrollDatum cinematicColor];
        [self.contentView addSubview:_sawTenButton];
        [_sawTenButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-ScrollDatum.tildeStopHit.fireFootnote);
            make.size.mas_equalTo(CGSizeMake(ScrollDatum.tildeStopHit.vowelHasSide, ScrollDatum.tildeStopHit.vowelHasSide));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _sawTenButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [ScrollDatum cinematicColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = ScrollDatum.tildeStopHit.andBloodNow;
    frame.size.width -= ScrollDatum.tildeStopHit.jouleEggMild;
    frame.origin.y += ScrollDatum.tildeStopHit.andBloodNow;
    frame.size.height -= ScrollDatum.tildeStopHit.andBloodNow;
    [super setFrame:frame];
}

-(void)setSpaOwnOutView:(NSString *)spaOwnOutView {
    _spaOwnOutView = spaOwnOutView;
    [self.blinkFloorView sd_setImageWithURL:[NSURL URLWithString:spaOwnOutView] placeholderImage:nil];
}

- (void)setKeyExecute:(OldestNiacinAffineOptCountingGreek *)keyExecute {
    _keyExecute= keyExecute;
    self.spaOwnOutView = keyExecute.tapSilent;
    self.mixCursiveLabel.text = keyExecute.bagOutlet;
    NSString *note = keyExecute.musicGrow?:@"";
    if (note.useOffsetAge) {
        self.pauseFunkLabel.hidden = YES;
        [self.mixCursiveLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.blinkFloorView.mas_right).offset(ScrollDatum.tildeStopHit.fireFootnote);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.pauseFunkLabel.hidden = NO;
        NSRange uighur = [note rangeOfString:ScrollDatum.tildeStopHit.tapSignatureFunctionsCenterWritingTilde];
        NSRange better = [note rangeOfString:ScrollDatum.tildeStopHit.localityFourSymmetricFloorCircleThat];
        
        if (uighur.length == 0 && better.length == 0) {
            self.pauseFunkLabel.text = note;
            self.pauseFunkLabel.font = [UIFont systemFontOfSize:ScrollDatum.tildeStopHit.waxMenWatery];
            self.pauseFunkLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange moodEasy = NSMakeRange(uighur.location+uighur.length, better.location-(uighur.location+uighur.length));
            NSString *sinRed = [note substringWithRange:moodEasy];
            NSString *scanMen = [note stringByReplacingOccurrencesOfString:ScrollDatum.tildeStopHit.tapSignatureFunctionsCenterWritingTilde withString:@""];
            scanMen = [scanMen stringByReplacingOccurrencesOfString:ScrollDatum.tildeStopHit.localityFourSymmetricFloorCircleThat withString:@""];
            
            moodEasy = [scanMen rangeOfString:sinRed];
            NSMutableAttributedString *factOurCache = [[NSMutableAttributedString alloc] initWithString:scanMen];
            [factOurCache addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, scanMen.length)];
            [factOurCache addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, scanMen.length)];
            [factOurCache addAttribute:NSForegroundColorAttributeName value:[ScrollDatum cinematicColor] range:moodEasy];
            [factOurCache addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:moodEasy];
            
            self.pauseFunkLabel.attributedText = factOurCache;
        }
        
        [self.mixCursiveLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.blinkFloorView.mas_right).offset(ScrollDatum.tildeStopHit.fireFootnote);
            make.top.equalTo(self.blinkFloorView).offset(ScrollDatum.tildeStopHit.wasPhotoTap);
        }];
    }
}

@end
