Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuwind/HHTransition
主流转场动画,无侵入,API简单易用。
https://github.com/yuwind/HHTransition
Last synced: 3 months ago
JSON representation
主流转场动画,无侵入,API简单易用。
- Host: GitHub
- URL: https://github.com/yuwind/HHTransition
- Owner: yuwind
- License: mit
- Created: 2018-04-23T02:52:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-08T05:46:45.000Z (10 months ago)
- Last Synced: 2024-10-31T04:47:39.481Z (4 months ago)
- Language: Objective-C
- Homepage:
- Size: 313 KB
- Stars: 847
- Watchers: 14
- Forks: 136
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- Awesome-iOS - HHTransition - 主流转场动画,无侵入,API简单易用。 (UI Effects)
README
**主流转场动画**
### 1、HHTransition优势
1、API只有两个方法,易调用
2、面向切面编程,无侵入,不需要在VC中设置代理
3、易扩展,只需要重写转场对象即可
### 2、HHTransition不足
1、不够灵活,对于同一个转场对象无法设置不同的转场时间
2、如果需要传参,需要通过协议传递,漏写协议,编译时无法发现问题
### 3、类图

### 4、使用说明
#### 1、API使用
```objc
//present转场
- (void)hh_presentViewController:(UIViewController *)viewController presentStyle:(HHPresentStyle)presentStyle completion:(void (^__nullable)(void))completion
//push转场
- (void)hh_pushViewController:(UIViewController *)viewController style:(HHPushStyle)style;
```
例如:
```objc
[testViewController hh_presentViewController:viewController presentStyle:HHPresentStyleSlipFromTop completion:nil];
```
#### 2、扩展性
1、在`HHTransitionUtility`类下,增加枚举类型
2、增加转场对象,可以继承`HHBaseAnimatedTransition`,内部已做好分发
3、在类HHInteractionDelegate或者HHTransitioningDelegate下,根据枚举类型,设置transition对象
例如:
```objc
- (id)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
switch (presented.presentStyle) {
case HHPresentStyleNone:
return nil;
case HHPresentStyleSlipFromTop:
case HHPresentStyleSlipFromBottom:
case HHPresentStyleSlipFromLeft:
case HHPresentStyleSlipFromRight:
return [HHPresentFlipTransition flipTransitionWithStyle:presented.presentStyle isBegining:YES];
default:
return nil;
}
}
```
```objc
- (id)animationControllerForDismissedController:(UIViewController *)dismissed {
switch (dismissed.presentStyle) {
case HHPresentStyleNone:
return nil;
case HHPresentStyleSlipFromTop:
case HHPresentStyleSlipFromBottom:
case HHPresentStyleSlipFromLeft:
case HHPresentStyleSlipFromRight:
return [HHPresentFlipTransition flipTransitionWithStyle:dismissed.presentStyle isBegining:NO];
default:
return nil;
}
}
```**部分效果如下**




**2018-05-17增加CATransition动画**
---


**支持cocoapod**
```objc
target 'MyApp' do
pod 'HHTransition', '~> 3.1.2'
end
```