乐趣 0.1.0

乐趣 0.1.0

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最新版本2017年4月
SwiftSwift版本3.0
SPM支持SPM

Mohammed Frgallah维护。



乐趣 0.1.0

  • 作者
  • frgallah

乐趣

简介

乐趣是一个用于视图控制器的交互式Core Image过渡,仅用于娱乐,不适用于真正的应用。通过使用几行代码,您可以获得优雅的过渡。

要求

  • iOS 10.0+
  • Xcode 8.2+
  • Swift 3

安装

手动

Sources文件夹复制到您的Xcode项目中。

用法

如何使用乐趣创建自定义过渡

导航和TabBar控制器

代码

在根视图控制器或第一个视图控制器中

  1. 获取您的Navigation或TabBar控制器引用
  2. 使用Navigation或TabBar控制器,过渡类型和是否为交互式作为参数创建Navigation或TabBar控制器代表。
  3. 可选:在您的代表对象中
  • 设置过渡持续时间
  • 设置手势方向
  1. 完成操作!

导航控制器

// In the root view  controller
override func viewDidLoad() {
super.viewDidLoad()
// 1-  Get a reference to your Navigation Controller
guard let navigationController = self.navigationController else {
return
}
// 2- Create a Navigation Controller delegate with :
let navigationControllerDelegate = FunNavigationControllerDelegate.init(navigationController: navigationController, transitionType: .ZoomBlur, isInteractive: true)
// 3- Optional: in your delegate object
//     - set the transition duration
//     - set the gesture direction
navigationControllerDelegate.duration = 1.4
navigationControllerDelegate.gesturePopDirection = .LeftToRight
}

TabBar控制器

// In the first view  controller
override func viewDidLoad() {
super.viewDidLoad()
// 1-  Get a reference to your TabBar Controller
guard let tabBarController = self.tabBarController else {
return
}
// 2- Create a tabBar Controller delegate with :
let tabBarControllerDelegate = FunTabBarControllerDelegate.init(tabBarController: tabBarController, transitionType: .ZoomBlur, isInteractive: true)
// 3- Optional: in your delegate object
//     - set the transition duration
//     - set the gesture direction
tabBarControllerDelegate.duration = 1.4
tabBarControllerDelegate.gestureDirection = .LeftToRight
}

模态控制器

在代码中

在源或呈现视图控制器中

  1. 创建或获取您的目标控制器引用
  2. 将目标控制器的模态表示风格设置为全屏
  3. 使用目标控制器和过渡类型作为参数创建模态控制器代表。
  4. 可选
  • 使过渡交互式
  • 设置过渡持续时间
  • 设置手势方向
  1. 完成操作!
// In the source or presenting view  controller:
@IBAction func presentViewControllerModally(_ sender: Any) {
// 1- Create your destination Controller
guard let destinationController = storyboard?.instantiateViewController(withIdentifier: "desVC") as? DestinationViewController else { return }
/* 
or get a reference to your destination controller if you are using prepare for segue function

let destinationController = segue.destination

*/

// 2- set the modal Presentation Style of your destination controller to full screen
destinationController.modalPresentationStyle = .fullScreen
// 3- Create a Modal Controller delegate using the destination controller and a transition type as parameters.
let controllerDelegate = FunModalControllerDelegate.init(destinationController: destinationController, transitionType: .ZoomBlur)
// 4- Optional:
// - make the transition interactive
// supply a pan gesture if the destination controller view already has a one, if not do not warry about it, the Modal Controller Delegate will create one for you. 
controllerDelegate.addInteractiveToDestinationController(panGesture: nil)
// - set the transition duration
controllerDelegate.duration = 2
// - set the gesture direction
controllerDelegate.gestureDismissalDirection = .RightToLeft
// - present the destination controller modally
present(destinationController, animated: true, completion: nil)
}

示例

要运行示例项目,请克隆仓库,然后首先从示例目录运行pod install

作者

frgallah,[email protected]

过渡

  • [ ] 高斯模糊
  • [ ] 模糊运动
  • [x] 缩放模糊
  • [ ] 波纹
  • [x] 圆形泼溅
  • [ ] Droste
  • [ ] 玻璃
  • [ ] 光隧道
  • [ ] 旋转
  • [ ] 涡轮
  • [x] 圆形屏幕
  • [ ] 点阵屏幕
  • [ ] 线形屏幕
  • [x] 晶化
  • [ ] 六边形像素化
  • [ ] 像素化
  • [ ] 拼点
  • [ ] 点状聚光灯
  • [x] 万花筒
  • [ ] 三角形万花筒
  • [ ] 三角形平铺

1. 缩放模糊


2. 晶化


3. 圆形泼溅


4. 圆形屏幕


5. 万花筒


许可

MasterTransitions 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。