项目介绍:
项目简介
FlowingMenu
FlowingMenu提供了一个交互式过渡管理器来显示一个流动和弹跳效果的菜单。
环境需求:
iOS 8.0+
Xcode 8.0+
Swift 3.0+
使用方法
首先,导入FlowingMenu
import FlowingMenu
然后只需添加一个FlowingMenuTransitionManager对象作为一个你想要展示的视图控件的transitioningDelegate即可:
let flowingMenuTransitionManager = FlowingMenuTransitionManager()
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let vc = segue.destination
vc.transitioningDelegate = flowingMenuTransitionManager
}
如果你想要交互式过渡,你需要实现FlowingMenuDelegate对象并定义需要手势交互的视图:
var menu: UIViewController?
override func viewDidLoad() {
super.viewDidLoad()
// Add the pan screen edge gesture to the current view
flowingMenuTransitionManager.setInteractivePresentationView(view)
// Add the delegate to respond to interactive transition events
flowingMenuTransitionManager.delegate = self
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let vc = segue.destination
vc.transitioningDelegate = flowingMenuTransitionManager
// Add the left pan gesture to the menu
flowingMenuTransitionManager.setInteractiveDismissView(vc.view)
// Keep a reference of the current menu
menu = vc
}
// MARK: – FlowingMenu Delegate Methods
func flowingMenuNeedsPresentMenu(_ flowingMenu: FlowingMenuTransitionManager) {
performSegue(withIdentifier: “PresentSegueName”, sender: self)
}
func flowingMenuNeedsDismissMenu(_ flowingMenu: FlowingMenuTransitionManager) {
menu?.performSegue(withIdentifier: “DismissSegueName”, sender: self)
}
github地址:https://github.com/yannickl/FlowingMenu