我可以使用UIImageView+AFNetworking异步地分别添加图像
[imageView setImageWithURL:[NSURL URLWithString:[self.data valueForKey:@"image_link"]]];
我还可以通过以下方式向UITextView添加图像
UITextView *text = [[UITextView alloc] init];
UIImageView *imageView = [UIImageView new];
[imageView setImage:[UIImage imageNamed:@"image.png"]];
CGRect aRect = CGRectMake(0, 0, 125, 120);
[imageView setFrame:aRect];
UIBezierPath *exclusionPath = [UIBezierPath bezierPathWithRect:aRect];
text.textContainer.exclusionPaths = @[exclusionPath];
[text addSubview:imageView];但是我不能在UITextView中异步地添加图像,比如
UITextView *text = [[UITextView alloc] init];
UIImageView *imageView = [UIImageView new];
[imageView setImageWithURL:[NSURL URLWithString:[self.data valueForKey:@"image_link"]]];
CGRect aRect = CGRectMake(0, 0, 125, 120);
[imageView setFrame:aRect];
UIBezierPath *exclusionPath = [UIBezierPath bezierPathWithRect:aRect];
text.textContainer.exclusionPaths = @[exclusionPath];
[text addSubview:imageView];那么,如何在UITextView中异步添加图像呢?
发布于 2014-10-22 13:14:35
使用调度:
dispatch_async(dispatch_get_main_queue(), ^{
// async UI update here
});https://stackoverflow.com/questions/26507571
复制相似问题