

#import "LinkWetSixView.h"
#import "SignRoundCivilCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface LinkWetSixView ()
@property (nonatomic, strong) UIImageView *tryGreatReplyImageView;
@end

@implementation LinkWetSixView

- (void)insertingInteriorConjugateFocusDescentChooseModel:(SonBlackJoinInfo *)model {
[self putTryNibblesSpaRegisterSheTagsModel:model];
    NSMutableArray *rotor = [NSMutableArray new];
    for (int i = 0; i<model.oddRanging; i++) {
        SignRoundCivilCell *pool = [[SignRoundCivilCell alloc]init];
        pool.deferringWon = model.tipRunLess;
        pool.channelCount = 1;
        pool.runBit = 6;
        pool.gurationPencil = CGFLOAT_MIN;
        CGRect poloRect = [model.tagsEraShake boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.andExecutingAcceptSpeakQuoteLocations] forKey:NSFontAttributeName] context:nil];
        pool.listHitSize = CGSizeMake(poloRect.size.width+8, poloRect.size.height+4);
        pool.model = model;
        [rotor addObject:pool];
    }
    [self eyeEndOffToken:rotor];
}

- (void)putTryNibblesSpaRegisterSheTagsModel:(SonBlackJoinInfo *)model {
    NSString *url = model.registryClearTabChatterKeyBox;

    if (url.length == 0) {
        _tryGreatReplyImageView.hidden = YES;
        _tryGreatReplyImageView.image = nil;
        return;
    }

    UIImageView *man = self.tryGreatReplyImageView;
    man.hidden = NO;
    if (man.superview != self) {
        [self insertSubview:man atIndex:0];
    } else {
        [self sendSubviewToBack:man];
    }

    [man sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        if (image) [self atomicLiteralImageView:man image:image];
    }];
}

- (void)atomicLiteralImageView:(UIImageView *)man image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat hasImpact = image.size.height / image.size.width * width;
        
        CGFloat youBase = (height - hasImpact) * 0.5;
        man.frame = CGRectMake(0, youBase, width, hasImpact);
    } else {
        man.frame = self.bounds;
    }
}

- (UIImageView *)tryGreatReplyImageView {
    if (!_tryGreatReplyImageView) {
        _tryGreatReplyImageView = [[UIImageView alloc] init];
        _tryGreatReplyImageView.contentMode = UIViewContentModeScaleToFill;
        _tryGreatReplyImageView.userInteractionEnabled = NO;
        _tryGreatReplyImageView.clipsToBounds = NO;
    }
    return _tryGreatReplyImageView;
}


- (void)tenWhoHowCorrectedArmourExport {
    if (_tryGreatReplyImageView) {
        [_tryGreatReplyImageView sd_cancelLatestImageLoad];
        [_tryGreatReplyImageView removeFromSuperview];
        _tryGreatReplyImageView.image = nil;
        _tryGreatReplyImageView = nil;
    }
}

- (void)stop {
    [super stop];
    [self tenWhoHowCorrectedArmourExport];
}

- (void)removeFromSuperview {
    [self tenWhoHowCorrectedArmourExport];
    [super removeFromSuperview];
}

@end
