送多个礼物崩溃 没时间看了 先这样吧
This commit is contained in:
@@ -367,7 +367,8 @@
|
||||
/// @param imageUrl 网络图片的地址
|
||||
- (NSMutableAttributedString *)createUrlImageAttribute:(NSString *)imageUrl {
|
||||
NetImageConfig *config = [[NetImageConfig alloc]init];
|
||||
config.autoLoad = NO;
|
||||
///先这样吧
|
||||
config.autoLoad = YES;
|
||||
NetImageView *imageView = [[NetImageView alloc]initWithUrl:imageUrl config:config];
|
||||
UIImage* image = imageView.image;
|
||||
if (image) {
|
||||
|
@@ -13,22 +13,22 @@
|
||||
- (void)setAttributedText:(NSAttributedString *)attributedText {
|
||||
NSUInteger length = attributedText.length;
|
||||
NSAttributedString* attributedTextCopy = [attributedText mutableCopy];
|
||||
for (int i = 0; i < length; i++) {
|
||||
YYTextAttachment* attachment = [attributedText yy_attributesAtIndex:i][YYTextAttachmentAttributeName];
|
||||
if (!attachment || ![attachment.content isKindOfClass:[NetImageView class]]) continue;
|
||||
NetImageView* imageView = attachment.content;
|
||||
if (!imageView.imageUrl) continue;
|
||||
|
||||
if (imageView.state == NetImageStateLoaded) {
|
||||
attributedTextCopy = [self updateNetImageAttribute:imageView attributes:attributedTextCopy index:i];
|
||||
continue;
|
||||
}
|
||||
|
||||
[imageView loadImage:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||
imageView.image = image;
|
||||
[super setAttributedText:[self updateNetImageAttribute:imageView attributes:self.attributedText index:i]];
|
||||
}];
|
||||
}
|
||||
// for (int i = 0; i < length; i++) {
|
||||
// YYTextAttachment* attachment = [attributedText yy_attributesAtIndex:i][YYTextAttachmentAttributeName];
|
||||
// if (!attachment || ![attachment.content isKindOfClass:[NetImageView class]]) continue;
|
||||
// NetImageView* imageView = attachment.content;
|
||||
// if (!imageView.imageUrl) continue;
|
||||
//
|
||||
// if (imageView.state == NetImageStateLoaded) {
|
||||
// attributedTextCopy = [self updateNetImageAttribute:imageView attributes:attributedTextCopy index:i];
|
||||
// continue;
|
||||
// }
|
||||
// //TODO 礼物送多了 总是崩溃 先注释了吧
|
||||
//// [imageView loadImage:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||
//// imageView.image = image;
|
||||
//// [super setAttributedText:[self updateNetImageAttribute:imageView attributes:self.attributedText index:i]];
|
||||
//// }];
|
||||
// }
|
||||
[super setAttributedText:attributedTextCopy];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user