答案 0 :(得分:4)
动画gif,如果只是按时间间隔按顺序显示的图像集合。您可以使用UIImageView
这样执行此操作:
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()
然后,您可以使用排除路径使文本在其周围流动。
答案 1 :(得分:1)
使用排除路径定义保持空闲的区域,而不是使用图像视图添加图像。
NSMutableArray *exclutionPaths = [NSMutableArray array];
[exclutionPaths addObject:[UIBezierPath bezierPathWithRect:CGRectInset(imageFrame, -4, 0)]];
[_textView.textContainer setExclusionPaths:exclutionPaths];
[_textView addSubview:imageView];