

#import "CatTheSlowView.h"
#import "CurlLevelPasteCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface CatTheSlowView ()
@property (nonatomic, strong) UIImageView *slantItsDeltaImageView;
@end

@implementation CatTheSlowView

- (void)userHandCleanYardInterestStrongModel:(TenPubIndoorInfo *)model {

    NSMutableArray *slide = [NSMutableArray new];
    for (int i = 0; i<model.hourStream; i++) {
        CurlLevelPasteCell *meal = [[CurlLevelPasteCell alloc]init];
        meal.seekContents = model.offTalkHit;
        meal.channelCount = 1;
        meal.creamy = 6;
        meal.optBleedDayFar = CGFLOAT_MIN;
        CGRect execRect = [model.ourPickerOld boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.exemplarCousinCopperAbsentSharpnessReady] forKey:NSFontAttributeName] context:nil];
        meal.hintSpaSize = CGSizeMake(execRect.size.width+8, execRect.size.height+4);
        meal.model = model;
        [slide addObject:meal];
    }
    [self loudClipSubTap:slide];
}

- (void)availCollisionPathMaleFootAirModalModel:(TenPubIndoorInfo *)model {
    NSString *url = model.regularArrivalPairSpacingUsePromise;

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

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

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

- (void)reclaimDemandImageView:(UIImageView *)mid image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat wonEnable = image.size.height / image.size.width * width;
        
        CGFloat caseHis = (height - wonEnable) * 0.5;
        mid.frame = CGRectMake(0, caseHis, width, wonEnable);
    } else {
        mid.frame = self.bounds;
    }
}

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


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

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

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

@end
