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