Reputation: 25927
I had a look at this question and it didn't work. I am also trying to avoid this sort of solution. In the end I am willing to go with a CADisplayLink
and change each frame manually. Still, is there a simpler way to do this?
Upvotes: 5
Views: 2081
Reputation: 52237
Use exclusion paths to define areas that are kept free, than add the image with an image view.
NSMutableArray *exclutionPaths = [NSMutableArray array];
[exclutionPaths addObject:[UIBezierPath bezierPathWithRect:CGRectInset(imageFrame, -4, 0)]];
[_textView.textContainer setExclusionPaths:exclutionPaths];
[_textView addSubview:imageView];
Upvotes: 1
Reputation: 344
An animated gif if just a collection of images which are displayed in sequence at a timed interval. You can do this with a UIImageView
like this:
imageView.animationImages = [UIImage(named: "uploadFrame0")!, UIImage(named: "uploadFrame1")!, UIImage(named: "uploadFrame2")!, UIImage(named: "uploadFrame3")!, UIImage(named: "uploadFrame4")!, UIImage(named: "uploadFrame5")!, UIImage(named: "uploadFrame6")!, UIImage(named: "uploadFrame7")!, UIImage(named: "uploadFrame8")!]
imageView.animationDuration = 1
imageView.startAnimating()
Then you can use exclusion paths to make the text flow around it.
Upvotes: 4