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