

#import "WaxSonPintView.h"
#import "FlipOnlyAssignCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface WaxSonPintView ()
@property (nonatomic, strong) UIImageView *oldLeastBloodImageView;
@end

@implementation WaxSonPintView

- (void)targetSlovenianSenseAcceptedAtomAcceptModel:(DayWriteCropInfo *)model {
[self bottomSingularMagnitudeAdditiveTypeSpeakPlaneModel:model];
    NSMutableArray *caret = [NSMutableArray new];
    for (int i = 0; i<model.retLearned; i++) {
        FlipOnlyAssignCell *hard = [[FlipOnlyAssignCell alloc]init];
        hard.sunCycleGrow = model.midAndStop;
        hard.channelCount = 1;
        hard.oxygen = 6;
        hard.onlineMenuGasp = CGFLOAT_MIN;
        CGRect fontRect = [model.extendingOwn boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.brokenOldItalicEachNotifiedThe] forKey:NSFontAttributeName] context:nil];
        hard.musicalSize = CGSizeMake(fontRect.size.width+8, fontRect.size.height+4);
        hard.model = model;
        [caret addObject:hard];
    }
    [self exactMagicFire:caret];
}

- (void)bottomSingularMagnitudeAdditiveTypeSpeakPlaneModel:(DayWriteCropInfo *)model {
    NSString *url = model.retainedSpecifiedEachPetiteRangingObtain;

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

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

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

- (void)ropeThickArtsImageView:(UIImageView *)own image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat givenDust = image.size.height / image.size.width * width;
        
        CGFloat dogDeny = (height - givenDust) * 0.5;
        own.frame = CGRectMake(0, dogDeny, width, givenDust);
    } else {
        own.frame = self.bounds;
    }
}

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


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

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

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

@end
