Skip to content

Commit

Permalink
Update of 2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerAndBull committed Dec 25, 2020
1 parent 91a3f78 commit a4fd054
Show file tree
Hide file tree
Showing 28 changed files with 667 additions and 83 deletions.
105 changes: 47 additions & 58 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

## What is the skeleton screen?

Find the comrades here, and more or less have an understanding of the skeleton screen, please allow me to swear first. Skeleton Screen is a solution to optimize the user's weak network experience, which can effectively alleviate the anxiety of users waiting.
Find the comrades here, and more or less have an understanding of the skeleton screen. Skeleton Screen is a solution to optimize the user's weak network experience, which can effectively alleviate the anxiety of users waiting.

## What is TABAnimated?

TABAnimated is a solution for iOS developers to automatically generate skeleton screens. Developers can configure the already developed views to configure some global/local parameters through TABAnimated to automatically generate a skeleton screen that is consistent with their length.
TABAnimated is a solution for iOS developers to automatically generate skeleton screens. Developers can configure the already developed views to configure some global/local parameters through TABAnimated to automatically generate a skeleton screen that is consistent with their length.
Of course, TABAnimated will help you manage the lifecycle of the skeleton screen.

## table of Contents
## Catalog

* [Integration Advantage] (#Integration Advantage)
* [Effect display] (#effect display)
Expand All @@ -35,54 +35,31 @@ Of course, TABAnimated will help you manage the lifecycle of the skeleton screen
* [Question Search] (#Question Search)
* [Last emphasis] (#last emphasis)

## Integration Advantage
## Features

What are the advantages of the TABAnimated integrated skeleton screen?
- Highly automated
- Low coupling
- High performance
- Suitable for various scenarios
- High degree of customization

- Is an automation solution with fast integration
- Zero coupling, easy to package its animation logic into the base library, and easy to remove
- With caching function, the pressure measurement switching controller is not stuck
- Wide range of scenarios, suitable for 99% of views in development
- The degree of freedom is very high and can be completely customized
- Automatically switch the dark mode skeleton screen
## Preview

## Show results

| Dynamic Effects | Card Projection | Breathing Lights |
| Dynamic Animation | Card View | Bin Animation |
| ------ | ------ | ------ |
| ![动态动画.gif](https://upload-images.jianshu.io/upload_images/5632003-56c9726a027ca5e2.gif?imageMogr2/auto-orient/strip) | ![卡片投影.gif](https://upload-images.jianshu.io/upload_images/5632003-fd01c795bb3f9e1a.gif?imageMogr2/auto-orient/strip) | ![呼吸灯.gif](https://upload-images.jianshu.io/upload_images/5632003-683062be0a23d5b8.gif?imageMogr2/auto-orient/strip) |

| Flash | Segmented View | Douban Effect |
| Shimmer Animation | Segmented View | Drop Animation |
| ------ | ------ | ------ |
| ![闪光灯改版.gif](https://upload-images.jianshu.io/upload_images/5632003-93ab2cf6950498ab.gif?imageMogr2/auto-orient/strip)| ![分段视图.gif](https://upload-images.jianshu.io/upload_images/5632003-4da2062be691cf0b.gif?imageMogr2/auto-orient/strip) | ![豆瓣.gif](https://upload-images.jianshu.io/upload_images/5632003-3ed9d6cc317891a3.gif?imageMogr2/auto-orient/strip) |

**Diablo mode: **
**Dark Mode**

| Toolbox Switching | setting page switching |
| ------ | ------ |
| ![工具箱切换.gif](https://upload-images.jianshu.io/upload_images/5632003-cf5c4f50eac6fe6c.gif?imageMogr2/auto-orient/strip) | ![setting设置切换.gif](https://upload-images.jianshu.io/upload_images/5632003-2d1fb96ec07d6bca.gif?imageMogr2/auto-orient/strip) |

## Demonstration process

Let's take a closer look at TABAnimated with a small example.

#### 1. Tom and Jack have a view like this, which needs to integrate the skeleton screen.

![Requirements.png](https://upload-images.jianshu.io/upload_images/5632003-8bb0895de7690f79.png?imageMogr2/auto-orient/strip%7CimageView2/3/w/300)

#### 2. The following is the effect generated by TABAnimated automation.

![自动化生成.png](https://upload-images.jianshu.io/upload_images/5632003-f10c2427f8b149ba.png?imageMogr2/auto-orient/strip%7CimageView2/3/w/300)

#### 3. Jack is doing this demand, I am very satisfied with this effect, then Jack’s work is over. But Tom said, I feel that the length and height are similar to the original view, but I am not satisfied with the animation effect, not refined enough. So, he quickly made the following adjustments through (pre-processing callback + chain syntax).

![Adjusted effect.png](https://upload-images.jianshu.io/upload_images/5632003-0affe19065135d31.png?imageMogr2/auto-orient/strip%7CimageView2/3/w/300)

Of course, everyone has different aesthetics, each product has different needs, and these are all handed over to you.

## Integration steps

### I. import into the project
## Installation

- CocoaPods

Expand All @@ -96,11 +73,13 @@ Pod 'TABAnimated'
Github "tigerAndBull/TABAnimated"
```

- Drag the TABAnimated folder into the project
- Drag the TABAnimated folder into your project

**Note: The demo demo downloaded on github, in order to simulate the real application scenario well, uses some familiar third parties, but TABAnimated does not depend on them. **
**Note: The demo demo downloaded on github, in order to simulate the real application scenario well, uses some familiar third parties, but TABAnimated does not depend on them.**

### II. global parameter initialization
## Usage

### I. global parameter initialization

Initialize `TABAimated` in `didFinishLaunchingWithOptions`

Expand All @@ -109,11 +88,11 @@ Initialize `TABAimated` in `didFinishLaunchingWithOptions`
[TABAnimated sharedAnimated].openLog = YES;
```

**Note: There are other animation types, global properties, and comments in the framework. **
**Note: There are other animation types, global properties, and comments in the framework.**

### III. Control view initialization
### II. Control view initialization

**Control view: If it is a list view, then it is UITableView/UICollectionView, there are documents to explain. **
**Control view: If it is a list view, then it is UITableView/UICollectionView, there are documents to explain.**

`NewsCollectionViewCell` is the cell used in your list, of course, you have to bind other cells, it is also possible!

Expand All @@ -123,12 +102,12 @@ _collectionView.tabAnimated =
cellSize:[NewsCollectionViewCell cellSize]];
```

**Note:**
**Note**

- ** There are other initialization methods, such as a variety of common cells, there are comments in the framework**
- ** There are local properties for this control view, there are comments in the framework**
- **There are other initialization methods, such as a variety of common cells, there are comments in the framework**
- **There are local properties for this control view, there are comments in the framework**

### IV. Control skeleton screen switch
### III. Control skeleton screen switch

Open animation

Expand All @@ -142,7 +121,7 @@ Open animation
[self.collectionView tab_endAnimation];
```

### V. Just said, how to use pre-processing callback + chain syntax?
### VI. Just said, how to use pre-processing callback + chain syntax?

```
_tableView.tabAnimated.adjustBlock = ^(TABComponentManager * _Nonnull manager) {
Expand All @@ -155,7 +134,7 @@ _tableView.tabAnimated.adjustBlock = ^(TABComponentManager * _Nonnull manager) {
#### 1. Some people see the above, they may be scared at once, is integration so complicated?

A: It does not need to be adjusted asynchronously. It needs to be adjusted to what extent, and it is related to your own constraints and product requirements. Therefore, it does not automatically generate the effect that any product, anyone is completely satisfied immediately.
You can rest assured that launching this feature will help developers adjust the results they want more quickly. **
You can rest assured that launching this feature will help developers adjust the results they want more quickly.**

#### 2. `manager.animation(x)`, what is x?

Expand Down Expand Up @@ -202,10 +181,26 @@ Divided into the following three

(3) Finally, find the corresponding initialization method and start the animation method in the framework!

## Problem Search
## Demonstration process

Let's take a closer look at TABAnimated with a small example.

#### 1. Tom and Jack have a view like this, which needs to integrate the skeleton screen.

** Of course, in practical applications, we also have a variety of views, TABAnimated has experienced many products, all can be dealt with.
But the above knowledge is certainly not enough. The following is a more detailed description of the document. **
![Requirements.png](https://upload-images.jianshu.io/upload_images/5632003-8bb0895de7690f79.png?imageMogr2/auto-orient/strip%7CimageView2/3/w/300)

#### 2. The following is the effect generated by TABAnimated automation.

![自动化生成.png](https://upload-images.jianshu.io/upload_images/5632003-f10c2427f8b149ba.png?imageMogr2/auto-orient/strip%7CimageView2/3/w/300)

#### 3. Jack is doing this demand, I am very satisfied with this effect, then Jack’s work is over. But Tom said, I feel that the length and height are similar to the original view, but I am not satisfied with the animation effect, not refined enough. So, he quickly made the following adjustments through (pre-processing callback + chain syntax).

![Adjusted effect.png](https://upload-images.jianshu.io/upload_images/5632003-0affe19065135d31.png?imageMogr2/auto-orient/strip%7CimageView2/3/w/300)

## Q&A

**Of course, in practical applications, we also have a variety of views, TABAnimated has experienced many products, all can be dealt with.
But the above knowledge is certainly not enough. The following is a more detailed description of the document.**

- You'd better have to (must) read the documentation:

Expand All @@ -225,12 +220,6 @@ But the above knowledge is certainly not enough. The following is a more detaile
**If you still can't solve the problem, you can contact me as soon as possible, I believe TABAnimated can solve 99% of the demand**

## Finally stressed:

- If you have problems, look at [demo] (https://github.com/tigerAndBull/LoadAnimatedDemo-ios) and the documentation. Basically, there are ~
- demo is just a guide, you can set more beautiful effects yourself.
- If there are usage problems, optimization suggestions, etc., you can directly mention the issue, you can add exchange group feedback: 304543771

## License

MIT License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong, readonly) NSMutableArray <NSValue *> *headerSizeArray;
@property (nonatomic, strong, readonly) NSMutableArray <NSValue *> *footerSizeArray;

// 绑定瀑布流高度代理的sel
@property (nonatomic, assign) SEL waterFallLayoutHeightSel;

// 如果你的代理就是dataSource的代理,就不用设置
@property (nonatomic, weak) id waterFallLayoutDelegate;

@property (nonatomic, copy) NSArray <NSNumber *> *waterFallLayoutHeightArray;

#pragma mark -

/**
Expand Down Expand Up @@ -169,6 +177,12 @@ NS_ASSUME_NONNULL_BEGIN
cellSizeArray:(NSArray <NSValue *> *)cellSizeArray
rowArray:(NSArray <NSNumber *> *)rowArray;

#pragma mark - 瀑布流

+ (instancetype)animatedWaterFallLayoutWithCellClass:(Class)cellClass
heightArray:(NSArray <NSNumber *> *)heightArray
heightSel:(SEL)heightSel;

#pragma mark - Header / Footer

/**
Expand Down Expand Up @@ -199,6 +213,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)addHeaderViewClass:(_Nonnull Class)headerViewClass viewSize:(CGSize)viewSize;
- (void)addFooterViewClass:(_Nonnull Class)footerViewClass viewSize:(CGSize)viewSize;


@end

NS_ASSUME_NONNULL_END
12 changes: 8 additions & 4 deletions TABAnimatedDemo/TABAnimated/Control/Include/TABTableAnimated.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) NSInteger animatedCount;

/**
UITableView动画启动时,同时启动UITableViewHeaderView
UITableView动画启动时,同时启动UITableViewHeaderView, 默认是YES
*/
@property (nonatomic, assign) BOOL showTableHeaderView;

/**
UITableView动画启动时,同时启动UITableViewFooterView
UITableView动画启动时,同时启动UITableViewFooterView, 默认是YES
*/
@property (nonatomic, assign) BOOL showTableFooterView;

Expand All @@ -54,6 +54,12 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong, readonly) NSMutableArray <NSNumber *> *headerHeightArray;
@property (nonatomic, strong, readonly) NSMutableArray <NSNumber *> *footerHeightArray;

// 与tableHeaderView对应的参数设置
@property (nonatomic, strong) TABViewAnimated *tabHeadViewAnimated;

// 与tableFooterView对应的参数设置
@property (nonatomic, strong) TABViewAnimated *tabFooterViewAnimated;

#pragma mark - 以下均为以section为单位的初始化方法

/**
Expand Down Expand Up @@ -214,8 +220,6 @@ NS_ASSUME_NONNULL_BEGIN

#pragma mark - DEPRECATED

@property (nonatomic, weak) TABViewAnimated *tabHeadViewAnimated DEPRECATED_MSG_ATTRIBUTE("直接使用tableView.tableHeaderView.tabAnimated获取");
@property (nonatomic, weak) TABViewAnimated *tabFooterViewAnimated DEPRECATED_MSG_ATTRIBUTE("直接使用tableView.tableFooterView.tabAnimated获取");
+ (instancetype)animatedWithCellClass:(Class)cellClass DEPRECATED_MSG_ATTRIBUTE("该回调在v2.3.0被弃用,请使用`animatedWithCellClass:cellHeight:`取代");

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong) TABCollectionAnimated * _Nullable tabAnimated;
@end

@class TABCollectionAnimated;
@interface UICollectionViewLayout (TABAnimated)
@property (nonatomic, strong) TABCollectionAnimated * _Nullable tabAnimated;
@end

NS_ASSUME_NONNULL_END
41 changes: 41 additions & 0 deletions TABAnimatedDemo/TABAnimated/Control/TABCollectionAnimated.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ + (instancetype)animatedInRowModeWithCellClass:(Class)cellClass
return obj;
}

+ (instancetype)animatedWaterFallLayoutWithCellClass:(Class)cellClass
heightArray:(NSArray <NSNumber *> *)heightArray
heightSel:(SEL)heightSel {
TABCollectionAnimated *obj = [TABCollectionAnimated _animatedWithCellClass:cellClass cellSize:CGSizeZero animatedCount:0 toIndex:0 runMode:TABAnimatedRunBySection];
obj.waterFallLayoutHeightArray = heightArray;
obj.waterFallLayoutHeightSel = heightSel;
return obj;
}

#pragma mark -

+ (instancetype)_animatedWithCellClass:(Class)cellClass
Expand Down Expand Up @@ -312,6 +321,16 @@ - (void)exchangeDataSourceMethods:(id<UICollectionViewDataSource>)dataSource
newSel:newFooterCellSel
target:target
delegate:dataSource];

if (self.waterFallLayoutHeightSel) {
SEL oldWaterFallLayoutHeight = self.waterFallLayoutHeightSel;
SEL newWaterFallLayoutHeight = @selector(tab_waterFallLayout:index:itemWidth:);

[self exchangeDelegateOldSel:oldWaterFallLayoutHeight
newSel:newWaterFallLayoutHeight
target:target
delegate:dataSource];
}
}

#pragma clang diagnostic pop
Expand Down Expand Up @@ -491,4 +510,26 @@ - (UICollectionReusableView *)tab_collectionView:(UICollectionView *)collectionV
return view;
}

#pragma mark - 瀑布流

- (CGFloat)tab_waterFallLayout:(UICollectionViewLayout *)waterFallLayout index:(NSInteger)index itemWidth:(CGFloat)itemWidth {
TABCollectionAnimated *tabAnimated = waterFallLayout.tabAnimated;
if (tabAnimated.state != TABViewAnimationStart) {
return [self tab_waterFallLayout:waterFallLayout index:index itemWidth:itemWidth];
}
return [tabAnimated.waterFallLayoutHeightArray[index] floatValue];
}

#pragma mark -

- (void)setWaterFallLayoutHeightArray:(NSArray<NSNumber *> *)waterFallLayoutHeightArray {
_waterFallLayoutHeightArray = waterFallLayoutHeightArray;
_animatedCount = waterFallLayoutHeightArray.count;
}

- (void)setAnimatedCount:(NSInteger)animatedCount {
if (_waterFallLayoutHeightArray.count > 0) return;
_animatedCount = animatedCount;
}

@end
24 changes: 20 additions & 4 deletions TABAnimatedDemo/TABAnimated/Control/TABTableAnimated.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ - (instancetype)init {
if (self = [super init]) {
_headerHeightArray = @[].mutableCopy;
_footerHeightArray = @[].mutableCopy;
_showTableHeaderView = YES;
_showTableFooterView = YES;
}
return self;
}
Expand Down Expand Up @@ -232,18 +234,32 @@ - (void)refreshWithIndex:(NSInteger)index controlView:(UIView *)controlView {

if (self.showTableHeaderView) {
if (tableView.tableHeaderView.tabAnimated == nil) {
tableView.tableHeaderView.tabAnimated = TABViewAnimated.new;
if (tableView.tabAnimated.tabHeadViewAnimated) {
tableView.tableHeaderView.tabAnimated = tableView.tabAnimated.tabHeadViewAnimated;
}else {
tableView.tableHeaderView.tabAnimated = TABViewAnimated.new;
}
}
TABViewSuperAnimationType superAnimationType = tableView.tableHeaderView.tabAnimated.superAnimationType;
if (superAnimationType == TABViewSuperAnimationTypeDefault) {
tableView.tableHeaderView.tabAnimated.superAnimationType = superAnimationType;
}
tableView.tableHeaderView.tabAnimated.superAnimationType = tableView.tabAnimated.superAnimationType;
tableView.tableHeaderView.tabAnimated.canLoadAgain = tableView.tabAnimated.canLoadAgain;
[tableView.tableHeaderView tab_startAnimation];
}

if (self.showTableFooterView) {
if (tableView.tableFooterView.tabAnimated == nil) {
tableView.tableFooterView.tabAnimated = TABViewAnimated.new;
if (tableView.tabAnimated.tabFooterViewAnimated) {
tableView.tableFooterView.tabAnimated = tableView.tabAnimated.tabFooterViewAnimated;
}else {
tableView.tableFooterView.tabAnimated = TABViewAnimated.new;
}
}
TABViewSuperAnimationType superAnimationType = tableView.tableFooterView.tabAnimated.superAnimationType;
if (superAnimationType == TABViewSuperAnimationTypeDefault) {
tableView.tableFooterView.tabAnimated.superAnimationType = superAnimationType;
}
tableView.tableFooterView.tabAnimated.superAnimationType = tableView.tabAnimated.superAnimationType;
tableView.tableFooterView.tabAnimated.canLoadAgain = tableView.tabAnimated.canLoadAgain;
[tableView.tableFooterView tab_startAnimation];
}
Expand Down
Loading

0 comments on commit a4fd054

Please sign in to comment.