簡單配置:
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。這樣就可以移動了~
完??