拉伸图片
2021-03-31 本文已影响0人
guoguojianshu
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:message.appAttireUserListDto.chat.attireImg] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
if (image) {
// UIImage * bubbleImage = [UIImage imageNamed:@"201"];
// UIImage * bubbleImage = image;
// UIImage * bubbleImage = [UIImage imageWithCGImage:image.CGImage scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp];
UIImage * bubbleImage = [UIImage imageWithCGImage:image.CGImage scale:3 orientation:UIImageOrientationUp];
UIImage * newImage = [bubbleImage resizableImageWithCapInsets:UIEdgeInsetsMake(bubbleImage.size.height*0.5-1, bubbleImage.size.width*0.5-1, bubbleImage.size.height*0.5-1, bubbleImage.size.width*0.5-1) resizingMode:UIImageResizingModeStretch];
self.XSBackImageView.image = newImage;
}
}];