找到这里的同志,或多或少都对骨架屏有所了解,请允许我先啰嗦一句。骨架屏(Skeleton Screen)是一种优化用户弱网体验的方案,能够有效缓解用户等待的焦躁情绪。ios
TABAnimated是提供给iOS开发者自动生成骨架屏的一种解决方案。开发者能够将已经开发好的视图,经过TABAnimated配置一些全局/局部的参数,自动生成与其长相一致的骨架屏。 固然,TABAnimated会协助你管理骨架屏的生命周期。git
经过TABAnimated集成的骨架屏有什么优点?github
动态效果 | 卡片投影 | 呼吸灯 |
---|---|---|
![]() |
![]() |
![]() |
闪光灯 | 分段视图 | 豆瓣效果 |
---|---|---|
![]() |
![]() |
![]() |
下面经过一个小例子,更深刻地了解一下TABAnimated。api
固然啦,每一个人有不一样的审美,每一个产品有不一样的需求,这些就全交由你来把握啦~缓存
pod 'TABAnimated'
复制代码
github "tigerAndBull/TABAnimated"
复制代码
注意: 在github上下载的演示demo,为了很好的模拟真实的应用场景,使用了一些你们都熟悉的第三方,可是TABAnimated自身并不依赖他们。bash
在 didFinishLaunchingWithOptions
中初始化 TABAimated
app
[[TABAnimated sharedAnimated] initWithOnlySkeleton];
[TABAnimated sharedAnimated].openLog = YES;
复制代码
注意:还有其余的动画类型、全局属性,在框架中都有注释。框架
控制视图:若是是列表视图,那么就是UITableView/UICollectionView,有文档具体讲解。异步
NewsCollectionViewCell
就是你列表中用到的cell,固然你要绑定其余cell,也是彻底能够的!工具
_collectionView.tabAnimated =
[TABCollectionAnimated animatedWithCellClass:[NewsCollectionViewCell class]
cellSize:[NewsCollectionViewCell cellSize]];
复制代码
注意:
[self.collectionView tab_startAnimation];
复制代码
[self.collectionView tab_endAnimation];
复制代码
_tableView.tabAnimated.adjustBlock = ^(TABComponentManager * _Nonnull manager) {
manager.animation(1).down(3).radius(12);
manager.animation(2).height(12).width(110);
manager.animation(3).down(-5).height(12);
};
复制代码
答:需不须要异步调整,须要调整到什么程度,与你自身约束、产品需求,都有关系。因此并不能自动生成让任何产品、任何人当即都彻底满意的效果。 你大可放心,推出这个功能反而是协助开发者更快速调整本身想要的结果。**
manager.animation(x)
,x是多少?答:在appDelegate设置TABAnimated的openAnimationTag
属性为YES,框架就会自动为你指示,究竟x是几
[TABAnimated sharedAnimated].openAnimationTag = YES;
复制代码
manager.animation(0).height(12).width(110);
复制代码
manager.animation(1).placeholder(@"占位图名称.png");
复制代码
manager.animations(1,3).width(50);
复制代码
manager.animationWithIndexs(1,5,7).down(5);
复制代码
固然啦,在现实中,咱们还有各式各样的视图,TABAnimated经历了不少产品的考验,通通均可以应对。 可是光凭上面的知识确定是不够的,如下是更详细说明文档。
若是你仍没法解决问题,能够尽快联系我,我相信TABAnimated是能够解决99%的需求的