

#import "JumpSchemeView.h"
#import "ModelDueCarDidCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface JumpSchemeView ()
@property (nonatomic, strong) UIImageView *unwrapMountedImageView;
@end

@implementation JumpSchemeView

- (void)parentRegularDistantPurposeGaelicCommandModel:(DailyLargestInfo *)model {

    NSMutableArray *hindi = [NSMutableArray new];
    for (int i = 0; i<model.wonTapPair; i++) {
        ModelDueCarDidCell *iron = [[ModelDueCarDidCell alloc]init];
        iron.filmApplyZip = model.midBusLogo;
        iron.channelCount = 1;
        iron.period = 6;
        iron.oddHallBondJob = CGFLOAT_MIN;
        CGRect mustRect = [model.redTallTitle boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.exclusionMembersAffectedCompileSmoothedCentrals] forKey:NSFontAttributeName] context:nil];
        iron.highCapSize = CGSizeMake(mustRect.size.width+8, mustRect.size.height+4);
        iron.model = model;
        [hindi addObject:iron];
    }
    [self dogCanFixTrust:hindi];
}

- (void)packWrapperEqualArchivedWakeFourteenAskModel:(DailyLargestInfo *)model {
    NSString *url = model.stillLigaturesPutIrregularStylusPast;

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

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

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

- (void)lowGaspWetTagImageView:(UIImageView *)bar image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat nearPrior = image.size.height / image.size.width * width;
        
        CGFloat picture = (height - nearPrior) * 0.5;
        bar.frame = CGRectMake(0, picture, width, nearPrior);
    } else {
        bar.frame = self.bounds;
    }
}

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


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

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

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

@end
