To run the example project, clone the repo, and run pod install
from the Example directory first.
MLFloatView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MLFloatView'
// 设置frame
func initializeStyleOne(){
// 在初始化之前设置一些默认值
MLFloatView.configFloatViewDefaultValue(edgeScreenOffset: 5, distanceTaBarOffset: 20, isAnimation: true)
floatView = MLFloatView.init(image: UIImage.init(named: "redpacket"))
let size = (floatView.image?.size)!
let screenWidth = UIScreen.main.bounds.width
let screenHeigh = UIScreen.main.bounds.height
floatView.frame.origin = CGPoint(x: screenWidth - size.width - 20, y: screenHeigh - size.height - 50)
floatView.delegate = self
floatView.clickActionBlock = {(floatView) -> Void in
print("\(#line):\(#function)")
}
self.view .insertSubview(floatView, at: self.view.subviews.count)
}
// 无需设置frame 快速创建
func initializeStyleTwo(){
// 在初始化之前设置一些默认值
MLFloatView.configFloatViewDefaultValue(edgeScreenOffset: 5, distanceTaBarOffset: 20, isAnimation: true)
floatView = MLFloatView.init(image: UIImage.init(named: "redpacket"), stopEdgeLocation: FloatViewAllShowState.AllShowRight)
floatView.clickActionBlock = {(floatView) -> Void in
print("\(#line):\(#function)")
}
self.view.insertSubview(floatView!, at: self.view.subviews.count)
}
func initializeStyleThree(){
// 在初始化之前设置一些默认值
MLFloatView.configFloatViewDefaultValue(edgeScreenOffset: 5, distanceTaBarOffset: 20, isAnimation: false)
floatView = MLFloatView.init(image: UIImage.init(named: "redpacket"), stopEdgeLocation: FloatViewAllShowState.AllShowRight)
floatView.clickActionBlock = {(floatView) -> Void in
print("\(#line):\(#function)")
}
self.view.insertSubview(floatView!, at: self.view.subviews.count)
}
DML, [email protected]
MLFloatView is available under the MIT license. See the LICENSE file for more info.