AboveWindow
描述
AboveWindow,一个位于基础窗口之上的第二窗口,支持将其隐藏到一个球中。
安装
CocoaPods
pod 'AboveWindow'
Carthage
目前不支持。
使用
// init AboveWindow
AboveWindow.shared.ballWidth = 60
AboveWindow.shared.isShowPanExitView = true // pan to show exit view
AboveWindow.shared.ballImage = UIImage(named: "thiago")
/* optional: set init stay postion (default: right of screen edge, middle of horizon)
let screenSize = UIScreen.main.bounds
AboveWindow.shared.stayPoint = CGPoint(x: screenSize.width - AboveWindow.shared.ballWidth - 10, y: 600)
// */
// push a new controller to AboveWindow
let controller = UIViewController()
controller.view.backgroundColor = .blue
AboveWindow.shared.push(root: controller, in: self.navigationController)
// hide the controller in AboveWindow
AboveWindow.shared.hide()
// show the origin controller in AboveWindow
AboveWindow.shared.show()
// or destroy the controller in AboveWindow
AboveWindow.shared.destroy()
// other properties
AboveWindow.shared.ballView.addSubview(customView) // add custom view into ball you like
AboveWindow.shared.nav = currentNav // change nav, push method set this property
AboveWindow.shared.imageView = customImageView
if AboveWindow.shared.isHideIntoBall {
// hide into ball, do something
}
需求
- iOS 9.0+
- Swift 4.2 到 5.1
许可
AboveWindow 采用 MIT 许可。