私聊,点击查看大图,卡顿

用的

UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:item.imageURL]]];

imageWithData当然会卡顿

正确的姿势:

- (void)showWithUrl:(NSString *)imageUrl originaFrame:(CGRect)originaFrame thumbImage:(UIImage *)thumbImage{
    self.frame = [UIApplication sharedApplication].keyWindow.frame;
    [[UIApplication sharedApplication].keyWindow addSubview:self];
    
    [self.imageIv sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:thumbImage];
    self.imageIv.frame = originaFrame;
    
    [self bringSubviewToFront:self.imageIv];
    [self bringSubviewToFront:self.saveBtn];
    
    CGFloat bigHeight = thumbImage.size.height / thumbImage.size.width * SCREEN_WIDTH;
    [UIView animateWithDuration:0.3 animations:^{
        self.imageIv.frame = CGRectMake(0, (SCREEN_HEIGHT - bigHeight) * 0.5, SCREEN_WIDTH, bigHeight);
    }];
}

使用缩略图作为站位图

原文地址:https://www.cnblogs.com/tufei7/p/8297009.html