

#import "AddTooTradView.h"
#import "PopRollShowKinCell.h"
#import "UIImageView+WebCache.h"

@interface AddTooTradView ()
@property (nonatomic, strong) UIImageView *textualOutputImageView;
@end

@implementation AddTooTradView

- (void)thermalMakerLargeOutAirborneCrossModel:(StylusOxygenInfo *)model {
[self slidingMoreLoopsSchemeFigureTooMirroredModel:model];
    NSMutableArray *bleed = [NSMutableArray new];
    for (int i = 0; i<model.weightsRun; i++) {
        PopRollShowKinCell *tree = [[PopRollShowKinCell alloc]init];
        tree.redActivated = model.bedSwapNap;
        tree.channelCount = 1;
        tree.binIts = 6;
        tree.custodianToken = CGFLOAT_MIN;
        CGRect lookRect = [model.tabHardShelf boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.useStrictlySuccessTwelveWayTelephony] forKey:NSFontAttributeName] context:nil];
        tree.ellipseSize = CGSizeMake(lookRect.size.width+8, lookRect.size.height+4);
        tree.model = model;
        [bleed addObject:tree];
    }
    [self liftHisBondAll:bleed];
}

- (void)slidingMoreLoopsSchemeFigureTooMirroredModel:(StylusOxygenInfo *)model {
    NSString *url = model.quietControlMalteseBreakLegacyWindows;

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

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

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

- (void)loadingFrenchImageView:(UIImageView *)wet image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat presented = image.size.height / image.size.width * width;
        
        CGFloat offsetY = (height - presented) * 0.5;
        wet.frame = CGRectMake(0, offsetY, width, presented);
    } else {
        wet.frame = self.bounds;
    }
}

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

@end
