简单配置:
pod安装(略)
包含头文件 (略)
添加悬浮按键和响应事件
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)
//
// 略
//
setupFlipBoard()
return true
}
func setupFlipBoard() {
let flipBoard = UIImageView(image: #imageLiteral(resourceName: "config"))
self.window?.addSubview(flipBoard)
flipBoard.autoSetDimensions(to: CGSize(width: 50, height: 50))
flipBoard.autoPinEdge(toSuperviewEdge: ALEdge.trailing, withInset: 20)
flipBoard.autoPinEdge(toSuperviewEdge: ALEdge.bottom, withInset: 100)
flipBoard.isUserInteractionEnabled = true
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(onFlipBoardClicked))
flipBoard.addGestureRecognizer(tapGesture)
}
func onFlipBoardClicked() {
FLEXManager.shared().showExplorer()
}
//这里只添加了点击事件,需要的话可以自己添加pangesture。这样就可以移动了~
完😃
网友评论