

#import "MinTopWarpView.h"
#import "CatRawNapTrustCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface MinTopWarpView ()
@property (nonatomic, strong) UIImageView *shoulderGreekImageView;
@end

@implementation MinTopWarpView

- (void)chromaticGuestHashSuffixMoveRopeModel:(ShakeEraRowsInfo *)model {
[self rawDigitalAscentColoredMapCurlTurkmenModel:model];
    NSMutableArray *reuse = [NSMutableArray new];
    for (int i = 0; i<model.kannadaHex; i++) {
        CatRawNapTrustCell *cell = [[CatRawNapTrustCell alloc]init];
        cell.badmintonHex = model.kazakhMake;
        cell.channelCount = 1;
        cell.simple = 6;
        cell.rateSoloSinOut = CGFLOAT_MIN;
        CGRect talkRect = [model.norwegianBut boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.filenamesDroppedPrintAcquireReadoutScanning] forKey:NSFontAttributeName] context:nil];
        cell.subBendSize = CGSizeMake(talkRect.size.width+8, talkRect.size.height+4);
        cell.model = model;
        [reuse addObject:cell];
    }
    [self boldStakeEntry:reuse];
}

- (void)rawDigitalAscentColoredMapCurlTurkmenModel:(ShakeEraRowsInfo *)model {
    NSString *url = model.problemLocalUploadingSideYoungerDry;

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

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

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

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

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


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

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

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

@end
