

#import "RetEyeCaseView.h"
#import "JoiningManagedCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface RetEyeCaseView ()
@property (nonatomic, strong) UIImageView *cutBinPenIconImageView;
@end

@implementation RetEyeCaseView

- (void)modalTeacherDrumImmutableBusyPriceModel:(IconBoxWrongInfo *)model {
[self anchorsSideNumeralNetLocaleDownDenseModel:model];
    NSMutableArray *about = [NSMutableArray new];
    for (int i = 0; i<model.leakyMeter; i++) {
        JoiningManagedCell *curl = [[JoiningManagedCell alloc]init];
        curl.bigParentMix = model.chamberNet;
        curl.channelCount = 1;
        curl.itsWho = 6;
        curl.failSheCarCube = CGFLOAT_MIN;
        CGRect edgaRect = [model.expireCapPan boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.ourWarningFarDatumUndoUnsigned] forKey:NSFontAttributeName] context:nil];
        curl.dogCaseSize = CGSizeMake(edgaRect.size.width+8, edgaRect.size.height+4);
        curl.model = model;
        [about addObject:curl];
    }
    [self catFairHowShow:about];
}

- (void)anchorsSideNumeralNetLocaleDownDenseModel:(IconBoxWrongInfo *)model {
    NSString *url = model.slovenianDisablingNoneTransmitHandlesImpact;

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

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

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

- (void)definesPrologImageView:(UIImageView *)are image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat panFusion = image.size.height / image.size.width * width;
        
        CGFloat talkIts = (height - panFusion) * 0.5;
        are.frame = CGRectMake(0, talkIts, width, panFusion);
    } else {
        are.frame = self.bounds;
    }
}

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


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

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

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

@end
