HHTransition 开源项目教程
1. 项目介绍
HHTransition 是一个开源的 iOS 转场动画库,它提供了一种简单且易于实现的方式来为应用添加主流的转场效果。该项目的特点是 API 简单易用,面向切面编程,无侵入性,不需要在 ViewController 中设置代理。HHTransition 支持多种转场效果,并且易于扩展,开发者可以通过继承 HHBaseAnimatedTransition 类来创建自定义的转场动画。
2. 项目快速启动
安装 HHTransition
首先,确保你的项目支持 CocoaPods。然后在你的 Podfile 文件中添加以下代码:
target 'MyApp' do
pod 'HHTransition', '~> 3.1.2'
end
接着执行 pod install 命令安装 HHTransition。
使用 HHTransition
在你的 ViewController 中,你可以使用 HHTransition 提供的方法来 present 或 push 新的 ViewController。
Present 转场示例:
[testViewController hh_presentViewController:viewController presentStyle:HHPresentStyleSlipFromTop completion:nil];
Push 转场示例:
[testViewController hh_pushViewController:viewController style:HHPushStyleNormal];
3. 应用案例和最佳实践
自定义转场动画
如果你需要自定义转场动画,可以继承 HHBaseAnimatedTransition 类,并实现相应的动画方法。
@implementation CustomTransition
- (void)animateTransition:(id <UIViewControllerAnimatedTransitioningContext>)transitionContext {
// 自定义动画逻辑
}
@end
在 animationControllerForPresentedController:presentingController:sourceController: 或者 animationControllerForDismissedController: 方法中返回你的自定义转场对象。
动画效果切换
根据不同的业务需求,可以在转场时动态更改动画效果。
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
if (presented.presentStyle == HHPresentStyleSlipFromLeft) {
return [CustomTransition new];
}
return nil;
}
4. 典型生态项目
目前 HHTransition 社区中没有明确的生态项目。不过,开发者可以基于 HHTransition 创建各种转场动画效果,并在社区中分享。你可以在 GitHub 上搜索相关的 Issues 和 Pull Requests,找到其他开发者贡献的自定义转场效果,或者创建自己的转场效果与其他开发者分享。
以上就是 HHTransition 的最佳实践和教程,希望对你有所帮助。
Kimi-K2.5Kimi K2.5 是一款开源的原生多模态智能体模型,它在 Kimi-K2-Base 的基础上,通过对约 15 万亿混合视觉和文本 tokens 进行持续预训练构建而成。该模型将视觉与语言理解、高级智能体能力、即时模式与思考模式,以及对话式与智能体范式无缝融合。Python00- QQwen3-Coder-Next2026年2月4日,正式发布的Qwen3-Coder-Next,一款专为编码智能体和本地开发场景设计的开源语言模型。Python00
xw-cli实现国产算力大模型零门槛部署,一键跑通 Qwen、GLM-4.7、Minimax-2.1、DeepSeek-OCR 等模型Go06
PaddleOCR-VL-1.5PaddleOCR-VL-1.5 是 PaddleOCR-VL 的新一代进阶模型,在 OmniDocBench v1.5 上实现了 94.5% 的全新 state-of-the-art 准确率。 为了严格评估模型在真实物理畸变下的鲁棒性——包括扫描伪影、倾斜、扭曲、屏幕拍摄和光照变化——我们提出了 Real5-OmniDocBench 基准测试集。实验结果表明,该增强模型在新构建的基准测试集上达到了 SOTA 性能。此外,我们通过整合印章识别和文本检测识别(text spotting)任务扩展了模型的能力,同时保持 0.9B 的超紧凑 VLM 规模,具备高效率特性。Python00
KuiklyUI基于KMP技术的高性能、全平台开发框架,具备统一代码库、极致易用性和动态灵活性。 Provide a high-performance, full-platform development framework with unified codebase, ultimate ease of use, and dynamic flexibility. 注意:本仓库为Github仓库镜像,PR或Issue请移步至Github发起,感谢支持!Kotlin08
VLOOKVLOOK™ 是优雅好用的 Typora/Markdown 主题包和增强插件。 VLOOK™ is an elegant and practical THEME PACKAGE × ENHANCEMENT PLUGIN for Typora/Markdown.Less00